Solved Trigger a control's datepicker with a separate button

Richard Horne

Member
Local time
Today, 16:45
Joined
Oct 15, 2020
Messages
55
Is it possible to have a control - formatted as a date - have its datepicker popup when a separate button is pressed?

Basically I want to put a date field on a form with a calendar icon next to it. When the calendar icon/button is clicked I want the datepicker to appear.

I know you can just click into the date field and the datepicker will popup automatically but I've been asked to build the form this specific way if possible.
 
you can have a Command button on the form.
on the Click event you add this code:
Code:
Private Sub Command1_Click()
Me![theDateTextbox].SetFocus
DoCmd.RunCommand acCmdShowDatePicker
End Sub
 
Better yet, you can make your own date picker.

 
you can have a Command button on the form.
on the Click event you add this code:
Code:
Private Sub Command1_Click()
Me![theDateTextbox].SetFocus
DoCmd.RunCommand acCmdShowDatePicker
End Sub

Oh as simple as that. I'd already set focus, didn't realise that's all I needed to do.

Thanks arnelgp :D
 

Users who are viewing this thread

Back
Top Bottom