automatic date & time for button-click

  • Thread starter Thread starter Kyle
  • Start date Start date
K

Kyle

I have a form I use for updating information for records in my
database. On the form I have a button that executes a VB object
printing out the report for that record only, using Tom Wickerath's
instructions posted on May 23, 2004.

What I'd like to add is the ability to have the date field in the form
automatically update to the current date when the button is clicked on,
but only then. I don't want the form to update the date just from
viewing the record. Since there's already [Event Procedure] in the "On
Click" under the button's Properties, what can I do to add this
capability?

Thanks!
 
Just add a line to change your "timestamp" field to the values you want.
Not sure what the field's name is, so I will use "timestamp"...


Timestamp = Now()
 
So I tried a few ideas, including yours, Rick, and came up with a
rather elegant solution considering my almost complete lack of Visual
Basic knowledge.

In the Sub that I copied from someone else to print out the single
record's report, I stuck the following line after the line for the
print command:
[EntryDate] = Date()
where "EntryDate" is the name of my date field. Now the date updates
after I click on the Print button on the form.

Schweet!
 
Oh, by the way, Rick, now that I've re-read your post, I finally
figured out that you were saying to put your line in my VB for the
button's procedure. Kyle says "D'oh!"

I did have to change it because we only track date, not date and time,
which Now() creates date and time and Date() was what I needed.
 
Great! That seems like an even better place to put it since that only fires
if the report actually loads property. Doing it in the "on click" for the
button might make the entry prematurely.
 

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

Back
Top