Inserting current date/time into Access db - Succe

Results 1 to 2 of 2

Thread: Inserting current date/time into Access db - Succe

  1. #1
    ricmac Guest

    Default Inserting current date/time into Access db - Succe

    Hi,<BR><BR>Some of you may recall that a week or so ago I sent some plaintive requests to advise me how to insert *current* date/time into an Access db. A solution eluded me then, but today I did another search on Messageboard for the answer (hoping a fresh start would bring reward). And yes, I discovered the answer in a post from Bill Wilkinson from early Oct. For the record (maybe someone could add to, here is Bill&#039s solution which thank goodness worked for me:<BR><BR> is even easier (From the ASP Q & A Forum)<BR>You can probably set up the DB so that the datestamp field gets "current time" by default, so you don&#039t even *have* to put it in via ASP code.<BR><BR>In Access, for example, when you specify the field do this:<BR><BR>(1) Open the table in DESIGN view.<BR>(2) Specify the (existing or new) field as a Date/Time field.<BR>(3) At the bottom of the form, in the Tab labeled "General", type this into the "Default Value" box:<BR>Now( )<BR><BR>That&#039s all there is to it! Now, every time you create a record in that table, Access will automatically assign the current server time to that field for the record. No ASP involved, at all!<BR><BR>Other DBs can do the same thing. The methodology will be similar, but the exact syntax will vary.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Server Version

    CREATE TABLE TestTimeStmp<BR>(IdNo INT IDENTITY(1,1),<BR>TiemStmp DateTime DEFAULT GETDATE(),<BR>FldA VarChar(10),<BR>CONSTRAINT pkTestTimeStmp PRIMARY KEY (ID))<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts