Current date and time default?

D

Dave L

Hi all!

How do I get Access to update a field in a form with a default value such as
Now()? I want this to occur when a record is being updated/changed. I do
not enter new records; I just update existing records. I know about the
ctrl-alt-spacebar thing but I want the default date and time to appear as I
enter that field. Basically I want to just tab through the field and have
the current date and time appear in that field.

The form I'm using uses a query to filter some data. Does this make a
difference in how this needs to be done?

Thanks in advance!
 
A

Arvin Meyer MVP

In the form's Dirty event, which occurs every time a record it added, or
edited, use a bit of code like:

Sub Form_Dirty(Cancel As Integer)
Me.NameOfTextBox = Now()
End Sub
 
G

golfinray

I put a save command button on my form (even though I know you don't HAVE to
have a save button) and then in onclick event I put
Me.last_updated = Now()
Put a last updated column in your table and it will save that for you.
 

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