Access Pop-Up Calendar

P

PPCO

I am using Martin Green's instructions for adding a calendar to an Access form.
It works great except if I click on today's date, it enters 12:00:00 AM. It
only does this the first time. If I enter any other date, it works fine. Or
if I enter another date other than today and then enter today's date, it
works fine. If I switch the format field to short date; it puts in
12/31/1899. Thanks!
Here is my code:
Option Compare Database



Private Sub cboDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
ocxCalendar.Visible = True
ocxCalendar.SetFocus


If Not IsNull(cboDate) Then
ocxCalendar.Value = cboDate.Value
Else
ocxCalendar.Value = Date
End If


End Sub

Private Sub Ctl_New_Click()
DoCmd.GoToRecord acActiveDataObject, , acNewRec
DoCmd.GoToControl "cboDate"
End Sub



Private Sub Form_Load()
If Not Me.NewRecord Then
RunCommand acCmdRecordsGoToNew
End If
End Sub




Private Sub Command16_Click()
On Error GoTo Err_Command16_Click


DoCmd.GoToRecord , , acNext

Exit_Command16_Click:
Exit Sub

Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click

End Sub

Private Sub ocxCalendar_Click()
cboDate.Value = ocxCalendar.Value
cboDate.SetFocus
ocxCalendar.Visible = False
End Sub



Private Sub Previous_Record_Click()
On Error GoTo Err_Previous_Record_Click


DoCmd.GoToRecord , , acPrevious

Exit_Previous_Record_Click:
Exit Sub

Err_Previous_Record_Click:
MsgBox Err.Description
Resume Exit_Previous_Record_Click

End Sub
Private Sub NEXT_RECORD_Click()
On Error GoTo Err_NEXT_RECORD_Click


DoCmd.GoToRecord , , acNext

Exit_NEXT_RECORD_Click:
Exit Sub

Err_NEXT_RECORD_Click:
MsgBox Err.Description
Resume Exit_NEXT_RECORD_Click

End Sub
Private Sub EXIT_FORM_Click()
On Error GoTo Err_EXIT_FORM_Click


DoCmd.Close

Exit_EXIT_FORM_Click:
Exit Sub

Err_EXIT_FORM_Click:
MsgBox Err.Description
Resume Exit_EXIT_FORM_Click

End Sub
 
D

Daniel Pineault

I could be wrong, but I do believe that he is using ActiveX and this should
be avoided as much as possible. Especially, when there are available
alternatives. Don't just take my work for it, search this very group and you
will see this is a common recommendation.

As such, I would strongly urge you to look at:

http://allenbrowne.com/ser-51.html
http://www.lebans.com/monthcalendar.htm

I have used both, and they are both excellent and 100% reliable! Easy to
install and use.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
P

PPCO

Yes, I have seen that... was going to risk it because I tried Allen
Browne's, but didn't see a way to re-size the day grid. I need it to be
really large. Might have missed something though...thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top