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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SETVALUE MACRO TO VBA 1

Status
Not open for further replies.

jailerg013

Technical User
Nov 19, 2003
16
US
Can someone tell me how I can double_click and get a date control to display the current date using VBA. I used a macro to do this on the Double_click event but I want to use VBA. Please Help!
 
Private Sub yourControl_DblClick()
Me!yourDateTextbox=Date()
EndSub

Short thing, isn't it? ;-)
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
I tried this
Code:
Private Sub Date_DblClick(Cancel As Integer)
Me!Date = Date
End Sub
but it still isn't working. The
Code:
()
after date keeps disappearing after I move to the next line.
 
Sure - this causes problems, cause you named your textbox "Date", which is a reserved word in Access. Rename it to "DatField" or "myDate" or even "Today".
If this doesn't solve all of it, try this:
Me!myDate=DateValue(Now())
(Although it means practically the same as Date(), this should function since it works with a different format...)

Keep rockin'...
[thumbsup2]
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
Makeitso, Thank you!! Thank you!!
I know there wasn't a whole lot to that, but I've been struggling with it for a while. You're awsome!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top