DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   MS Access and FileMaker Pro (http://www.daniweb.com/forums/forum128.html)
-   -   Access - Calendar Control (http://www.daniweb.com/forums/thread75208.html)

James890 Apr 13th, 2007 4:10 am
Access - Calendar Control
 
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


All times are GMT -4. The time now is 11:42 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC