James890 0 Newbie Poster

I'm wanting to use a calendar to select dates in Access 2003 and want it to pop up when a date field is clicked on. So I will want the same calendar to pop up to be used to select a date, from many differenct date fields on the form.

I've used a variable ('originator') to pass the date field name.
But it isn't working. Could someone check my code please?

(dob is the field I want the date to go into and Calendar6 is the name of the calendar I'm using.) Here's my code:

Option Compare Database
Option Explicit
Dim originator As ComboBox
Private Sub dob_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Set originator = dob
Calendar6.Visible = True
Calendar6.SetFocus
If Not IsNull(originator) Then
Calendar6.Value = originator.Value
Else
Calendar6.Value = Date
End If
End Sub
Private Sub Calendar6_Click()
originator.Value = Calendar6.Value
originator.SetFocus
Calendar6.Visible = False
Set originator = Nothing
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.