Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update field that has focus

Status
Not open for further replies.

AKMonkeyboy

IS-IT--Management
Feb 4, 2002
141
US
I would like to update ANY field in my form with the current date. I have a key down function built so when they press "ALT - D" the date will appear. However, I would like this date to appear in what ever field they are currently in. What would be the code for this? I'm aware of the "CTRL ;" key combo that will do this same thing, but that doesn't work with input masks.

A billion-trillion thanks in advance.

Monkey
 
Easy, example...

Screen.ActiveControl = format(now(),"mm/dd/yyyy")

You will, of course, need to verify that the control that has focus is indeed a text box before it causes a trappable error.

Hope that helps,

Gary
gwinn7
A+, Network+
 
Figured it was something simple, but didn't know where to start.

Thanks for the speedy reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top