Options to enter Now in a field

L

Linda RQ

Hi Everyone,

What are my options to enhance my Date and Time field on my form so the user
can either use a command button to insert the current date and time in the
field or key commands. Right now I am planning on them tabbing into the
field and using ctrl+semi-colon, space, ctrl+shft+; to insert the current
date and time. I have used a program before that you can use a key command
and then -1 and it would put yesterday's date in. Is there also any key
combo that will insert the date and time minus an hour or 2 hours?

Thanks,
Linda
 
G

Guest

Hi Linda

You can do this in many ways such as

When the users enters the now field

Private Sub NowField_Enter()
Me.NowField = Now()
End Sub

Use a button to enter the time into the now field

Private Sub SomeButon_Click()
Me.NowField = Now()
End Sub

I have assumed that the now field have been formated to show time.

Bascially you can insert this "now" into the field on a vast number of
events - it's just up to you to decide on which is most appropriate for your
users.


Hope this helps
 
L

Linda RQ

Hi Wayne,

I have had a lot of help when I have code entered into my databases. Would
I open up the properties of my field on the form "ThpyStDtTm" and go to the
Events tab then insert this code with the name of my field "ThpyStDtTm" in
the place or your "NowField"? Then make a command button and replace
"SomeButon" with my button's name? After typing my plan out, it doesn't
make sense because I have about 4 fields that this would be useful to insert
the Now Date into. If it's too much to explain, it's ok. The lady that
helps me one on one will be coming over on Saturday and she will no doubt
know what to do.

Thanks,
Linda
 
G

Guest

Yes

Ope the form in design view and select ThpyStDtTm. Open the properties box
and on the event coloumn go to the OnEnter and click build (the 3 ...) then
select code.
You will see this

Private Sub ThpyStDtTm_Enter()

End Sub

You need to add just 1 line of code to make it work so that it looks like this

Private Sub ThpyStDtTm_Enter()
Me.ThpyStDtTm = Now()
End Sub

Click save and close the build page. Still on the field properties go to
the format column and select Format and select either short time, medium
time, or whatever (you can play around with the format till you see something
you like).


Hope this helps
 

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