![]() |
|
|
#1
|
|||
|
|||
|
I'm trying to use a calendar in Access 2003 to enter data in data fields.
I found a site that showed how to write the code so it will popup when you click on the date field and then disappear when you select the date from the calendar. I got it working but I want to be able to access that same calendar for other date fields on the form. So I used a variable call 'originator' to pass the originators name to the variable. Only thing is...now it doesn't work. I get a type mismatch error and I don't know why. It's exactly the same as the example I found(obviously with my names substituted in). Please help. (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 |
|
#2
|
|||
|
|||
|
Try this:
Private Sub dob_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Calendar6.Visible=True Calendar6.SetFocus If Not IsNull(dob) Then Calendar6.Value = dob.value Else |
|
#3
|
|||
|
|||
|
Avoid the last one. for some reason I posted the reply incomplete:
Here it is Private Sub dob_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Calendar6.Visible = True Calendar6.SetFocus If Not IsNull(dob) Then Calendar6.Value = dob.Value Else Calendar6.Value = Date End If End Sub Private Sub Calendar7_Click() dob.Value = Calendar6.Value dob.SetFocus Calendar6.Visible = True End Sub |
|
#4
|
|||
|
|||
|
Oh... don't mind the calendar 7.... I forgot to change it to calendar 6
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Formating a control in MS Access Reports | Alex Motilal | Access | 3 | 11-15-2008 06:09 PM |
| Sending control to specific control | wasim_sono | Programming | 2 | 04-19-2007 06:19 AM |
| Export Access reports/query results to Outlook Calendar/Task | kfinpgh | Import/Export Data | 0 | 02-22-2007 10:09 AM |
| clock control in access | kfoyil | Access | 0 | 12-02-2006 10:38 AM |
| Calendar Mystery | BankWalker | Forms | 0 | 02-16-2006 10:29 AM |