need a form to auto date on table

Z

zippyties

I have a data base that keeps track of links and the date they were visited
last. I have a date field in my table that I would like to record the date
that the link was clicked.

I tried setting up an auto date in the table, however the form will not
overwrite if the latest date is newer.

How can I get my form that displays the the queried links to put date() into
the appropriate field on the table? This would allow me to filter my queried
results oldest to newest.

Thanks
 
G

Graham Mandeno

Hi Zippyties

There is no such thing as an "auto date" field.

You can set the DefaultValue of a date/time field to =Date() or =Now() and
this will ensure that new records that are created in your table have the
current date (and time if you use Now) written into that field.

To update a date/time field in a record that already exists, you must use an
event of a form. For example, it is common to use the form's BeforeUpdate
event to update a field recording when the record was last changed.

For your application, it sounds like you should use the Click event of the
control containing the link:

Private Sub MyLink_Click()
LastVisited = Now()
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top