• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

How do I get the current time to post to an access database field using FrontPage 2003 Database results wizard?

I have a sign in/out intranet that my client wants to use to track where employees are. One of the fields is Time. When a user edits his information I need the current time to be posted into the database so that when other users are looking for that person, the database results table will have the Time that the record was updated.
0
mstumpo
Asked:
mstumpo
  • 4
  • 3
1 Solution
 
hieloCommented:
mstumpo, the best apprach for this is to use to Define field in the database whose data type is Date/Time and set its the default to Now(). That way every time you insert a new record, it will automatically get the current time stamp. Ex: If you had the following table:
Test
============
name              type                default val
id                   Autonumber     Increment
name            Text                   ""
submittedOn Date/Time           Now

Then if you execute the following query:
Insert INTO Test(name) Values('John')

Then the autonumber and the submittedOn fields will be filled automatically for you.
0
 
mstumpoAuthor Commented:
Thanks but I don't think that is going to work. New records are not going to be added. When a user edits his record to indicate he is out of the office, or in a meeting, I would like the edit.asp page to pull the date and time somehow so when the page is submitted for update, the date and time of the update is recorded.
0
 
hieloCommented:
OK. you don't have to perform an INSERT to use function Now. The db has a built in function named Now which gives you the current time. So in your case you would need and update statement:
UPDATE Test SET submittedOn=Now(), name='John' WHERE id=1
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
hieloCommented:
FYI: If you are using ASP with vbscript as your server-side technology, there's a built in function also named Now() which gives you the current date/time.
0
 
mstumpoAuthor Commented:
Here is the FP update query;
UPDATE SignInOut SET EmpName = '::EmpName::' , EmpTime = '::EmpTime::' , EmpComment = '::EmpComment::' , etc.

So you are indicating to change the EmpTime to
UPDATE SignInOut SET EmpName = '::EmpName::' , EmpTime = 'Now()' , EmpComment = '::EmpComment::' etc..

If so, that breaks the update.
0
 
hieloCommented:
No need for quotes.
UPDATE SignInOut SET EmpName = '::EmpName::' , EmpTime = Now() , EmpComment = '::EmpComment::' etc..

0
 
mstumpoAuthor Commented:
Thanks! That was it. Tested and works. The existing manually entered time was replaced with today's date and current time. Thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now