Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Forms

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-12-2007, 06:13 PM
Novice
 
Join Date: Apr 2007
Posts: 2
James890
Default Access - Calendar Control

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
Reply With Quote
  #2  
Old 04-01-2009, 02:48 PM
JGG JGG is offline
Novice
 
Join Date: Apr 2009
Posts: 7
JGG is on a distinguished road
Default

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
Reply With Quote
  #3  
Old 04-01-2009, 02:51 PM
JGG JGG is offline
Novice
 
Join Date: Apr 2009
Posts: 7
JGG is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 04-01-2009, 02:52 PM
JGG JGG is offline
Novice
 
Join Date: Apr 2009
Posts: 7
JGG is on a distinguished road
Default

Oh... don't mind the calendar 7.... I forgot to change it to calendar 6
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -8. The time now is 08:20 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.