Calling click action on load event

elite311

Registered User.
Local time
Today, 09:08
Joined
May 21, 2010
Messages
18
I'm trying to have a calendar load on todays date and call the click event when it loads. I'm using the calendar to populate some text boxs and when a manually click the date it works fine. Now I just want todays date to be clicked and selected automatically so the text boxs are populated as soon as it loads with todays information.

Code:
Private Sub Form_Load()
Me.[GenCal].Value = Date
Me.[GenCal].Date = Click
End Sub
Is what I tried, I have read alot of posts on here and haven't been able to find a solution.


Code:
Private Sub GenCal_Click()
Me.service = DLookup("TechName", "Q_Service_Tech_On_Call")
Me.servicecell = DLookup("CellNumber", "Q_Service_Tech_On_Call")
End Sub

This code works fine and changes the textboxs when I click a new date on the calendar.

Any help would be great.
 
To execute a sub or function you simply type its name in your code. Some people like to use the Call keyword first ...
Code:
Sub Form_Load()
[COLOR="Green"]  'set the date[/COLOR]
  Me.GenCal = Date()
[COLOR="Green"]  'execute the click event handler[/COLOR]
  GenCal_Click
  [COLOR="Green"]'Call GenCal_Click[/COLOR]
End Sub
Dead simple.
Cheers,
 
Wow I was thinking this would be so much more difficult, I'm still learning VBA but it worked awesome. Thanks so much
 

Users who are viewing this thread

Back
Top Bottom