Navigate through records with the Calendar Control

pascal

isolation
Local time
Today, 12:59
Joined
Feb 21, 2002
Messages
62
Is it possible to navigate through records with the Calendar Control? What I want is the following. I have a form with a calendar control. The form is based on a table with several fields including a date field. This date field is unique. Now, I want to navigate through the records with the Calendar Control. When I click on a date on the Calendar Control that doesn't exist yet in my table, I want to see an empty record so that I can fill in a new record. When I click on a date on the Calendar Control that exists in my table, I want to see this record. Is this possible? If yes, does anyone knows how this can be done.

Thank you in advance.
 
When you click the ActiveX calendar, the date clicked is stored in

Me.YourCalendar'sName.Value

Use that value to query your data to see if such a record exists and if it doesn't create it.
 
Thank you Likhoutx for your reply. But is it possible to give me some more information because I still don't know how to solve this problem. I've tried several things already but still haven't found what I'm looking for.

Thanks again.
 
I tried something similar to what you are doing and found it impossible. i wanted to bring up a daily schedule by clicking on a specific day field in the calendar. exmpl, if you click on March 3rd in brings up all the appointments for march 3rd. i even had some programmers on our IT department working on it and they had no luck either. I'll be intrested to see if you figure it out.
Good Luck
JG
 
I suggest that you build your own calender rather than use Access' ActiveX control as it's difficult to use. The coding of a calendar is not as hard as you think. There's several articles in the Access literatuire on how to do same.
 
i regulary use the on click event for the calender control
to do similiar things to what you want,i havent experienced
any problems with it yet
i am using access2000 with version9 calender control
 
OK, this is what I found so far. And it works. If anyone has an even better solution, please let me know. Just one little problem left: every time I click on a date that's not in my table yet a new record is added.


Option Compare Database

Private Sub Form_Current()

ctlCalendar = MyDateField

End Sub

Private Sub Form_Load()

ctlCalendar.Value = Date

End Sub

Private Sub ctlCalendar_Click()
' Find the record that matches the control.
Dim rs As Object
NewDate = ctlCalendar
Set rs = Me.Recordset.Clone
rs.FindFirst "[MyDateField] = #" & Format(Me![ctlCalendar], "mm\/dd\/yyyy") & "#"
If rs.NoMatch Then
DoCmd.GoToRecord , , acNewRec
ctlCalendar = NewDate
MyDateField = NewDate
Else
Me.Bookmark = rs.Bookmark
End If
End Sub
 
that pretty much what i do,there may be better ways,perhaps the real experts who use this forum may suggest one.

"MydateField" is bound, so as soon as you asign
the new date to it, it creates a new record
if you dont want to have a new record automatically
dont assign any value to the mydatefield
 

Users who are viewing this thread

Back
Top Bottom