Hot key's

A

Antonio

I have a database that has several forms used for various
applications involving the entering of a date in one of
the forms various fields. I was wondering if it was
possible to do the following-
A form is opend by the user containing 4 fields. The
first two fields are "Date" (start and end)fields and the
last two fields are "Time" (start and end) fields. When
the first field has the focus, I would like the user to
be able to hit "T" on their key board and it enter
today's date "Date()". If they hit "Y" they it would
enter yesterdays date. This would be the case when the
first two fields have the focus. When the second two
fields get the focus, hitting "N" on the key board would
enter the current time.
Is this possible?
TIA
 
V

Van T. Dinh

Check Access VB Help on the KeyDown or KeyPress Event,
IIRC, you should be able to use one of these Events to
assign the value to the Control.

There are some inbuilt shortcuts you can also use:

Ctrl + ; gives today's date
Ctrl + Shift + : gives current time.

HTH
Van T. Dinh
MVP (Access)
 
G

Guest

-----Original Message-----
Check Access VB Help on the KeyDown or KeyPress Event,
IIRC, you should be able to use one of these Events to
assign the value to the Control.

There are some inbuilt shortcuts you can also use:

Ctrl + ; gives today's date
Ctrl + Shift + : gives current time.

HTH
Van T. Dinh
MVP (Access)

Thanks for the response.
I took a look at the KeyDown/KeyPress event, and I have
been able to specify changing the value to Date(), but
only with the Tab, Shift, Ctl, Alt keys. I dont see a way
to specify the "T" key and not the others.
Antonio
 
A

Antonio

Thanks for the response.
I took a look at the KeyDown/KeyPress event, and I have
been able to specify changing the value to Date(), but
only with the Tab, Shift, Ctl, Alt keys. I dont see a way
to specify the "T" key and not the others.
Antonio
 
D

Douglas J. Steele

Private Sub Text0_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "t" Then
KeyAscii = 0
Me.Text0.Value = Date
End If
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