Help with Autokey please

S

Sheila D

Hi

I would like to assign today's date to the F2 key. I understand the Autokeys macro and have named macro {F2} but cannot figure out the code I need to say whatever field I am in type todays date - must use Date() function somehow I know.

I'm not a VB whizz so help would be much appreciated

Thanks in advance
 
A

Allen Browne

Use the SetValue action, on Screen.ActiveControl

As always, the macro cannot be bombproof, e.g. it will cause problems if the
active control is a command button, or a numeric field, or the form is
read-only, or ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Sheila D said:
I would like to assign today's date to the F2 key. I understand the
Autokeys macro and have named macro {F2} but cannot figure out the code I
need to say whatever field I am in type todays date - must use Date()
function somehow I know.
 
S

Sheila D

That's brilliant Allen

Tx

Sheila

Allen Browne said:
Use the SetValue action, on Screen.ActiveControl

As always, the macro cannot be bombproof, e.g. it will cause problems if the
active control is a command button, or a numeric field, or the form is
read-only, or ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.


Autokeys macro and have named macro {F2} but cannot figure out the code I
need to say whatever field I am in type todays date - must use Date()
function somehow I know.
 
D

Dirk Goldgar

Sheila D said:
Hi

I would like to assign today's date to the F2 key. I understand the
Autokeys macro and have named macro {F2} but cannot figure out the
code I need to say whatever field I am in type todays date - must use
Date() function somehow I know.

I'm not a VB whizz so help would be much appreciated

Thanks in advance

Are you aware that the Ctrl+; combination -- that is, "control
semicolon" -- is already defined to insert the date?
 
G

giampaolo

Sheila D said:
Hi

I would like to assign today's date to the F2 key. I understand the
Autokeys macro and have named macro {F2} but cannot figure out the code I
need to say whatever field I am in type todays date - must use Date()
function somehow I know.
 
Top