Adding Date/Time to a button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a databse that has a button created with the wizard to add a record.
I would like to also have it record the Date/Time to a table. The VB window
opens up and I'm not positive on the information that needs to be entered.

I'm OK with Access, but with VB or expressions I'm new at.

I'm thinking that this is a procedure, but I'm not sure of all the
information that needs to be added. Something with Now() but what else?

And help would be appreciated.
Thanks!
 
Net,
If you indicated "Event Procedure" in your button's OnClick event, then the forms
module is where you would enter the "hand written" VB code for going to a New record.
If you want to use a Macro, write the macro, and call that macro in the OnClick event
text box by selecting that Macro from the OnClick dropdown list..

But... a simpler solution is to set the DefaultValue for your date field to...
=Date()
Every time you goto a new record, today's date will be entered automatically. You can
override that manually if needed, but you'll get today's date bt "default."

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Al,
WHen adding the default value to be =Date(), it will return the dtae, but
the problem is I have a start time being recorded for a new record. I need to
have the time recorded when the button gets clicked whcih will be at a later
time when the job is completed. I'm not quite sure how I could add this with
a macro. I've also got the OnClick assigned to an event that adds the record.
So I'm thinking it needs to be added to the current event by code.

Thank you,
 
Net,
Not sure if I understand...
But... when you click the button...
Me.SomeDateTimeFieldName = Now()
will update that field to the current Date and Time.
Generally... there are instances where only a Date is needed, but regarding Time... I'd
suggest always capturing DATE & Time for that value.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 

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