Re-Post - help please

  • Thread starter Thread starter K Crofts
  • Start date Start date
K

K Crofts

Hi, i have posted this previously but maybe did not
explain myself well enough to receive any help.
I have a calender control on my form, when a date is
selected on it it puts this date into a text box
(''Date'').
I need to be able to click on a date on the calender and
bring up the relevant record for that date (i thought the
addition of the text box would make coding easier), if no
record exists i need a new one to be created.
Any help at all would be appreciated.
Ta
 
Hi Ta:

As you've already seen, the events on the Calendar Control suck... but
here's what I've done to get around them. In one of my projects, I use the
Calendar control to select a date, then use that date to select a particular
physician's list of patients:

1) on my form I have the Calendar control ("ocxCalendar"), a clickbutton
("command73"), and a combobox ("Combo21"), and the subform with the list of
patient appointments
2) Combo21 brings up the list of physician names; there are 2 procedures
associated with this combobox:

Sub Combo21_Change()
If Not IsNull(ocxCalendar.value) Then
[SCHDATE] = ocxCalendar.value
End If
Set dbs = CurrentDb()
Set rst = Forms![scheduler1]![Scheduler2b].Form.RecordsetClone
If rst.RecordCount = 0 Then
Forms![scheduler1]![Scheduler2b].Form![Frame51].Visible = True
GoTo last:
End If
rst.MoveFirst
rst.MoveLast
If rst.RecordCount > 10 Then
Forms![scheduler1]![Scheduler2b].Form![Frame51].Visible = True
End If
rst.Close
dbs.Close
GoTo last:
last:
Forms!scheduler1!Scheduler2b.Form![Text50] = Me![Combo21]
Forms!scheduler1!Scheduler2b.Form![Text41] = Me![ocxCalendar].value
Forms!scheduler1!Scheduler2b.Form.Refresh
Forms!scheduler1!Scheduler2b.Form.Refresh
Me.Refresh
Exit Sub
End Sub

Private Sub Combo21_NotInList(NewData As String, Response As Integer)
MsgBox "You have typed in the wrong name! Please try again. If you wish to
change the physician name, press the cardfile button to the right."
Exit Sub
End Sub

3) The ocxCalendar's only active procedure is:

Private Sub ocxCalendar_LostFocus()
If Not IsNull(ocxCalendar.value) Then
SCHDATE = ocxCalendar.value
End If
End Sub

' Note that this procedure is activated once the user clicks on either the
clickbutton or the combobox.

4) The subform is linked to the Parent form by the 2 key fields- SCHDATE
(the selected date field) and PERSMD (the selected physician). This subform
changes when combo21 is updated.

It works in a pretty neat manner. I guess it's best that I post the applet
on my download site- it's easier to see how things are set up that way. You
can access "Scheduler.zip" by logging onto my Yahoo Briefcase download site
at the following URL: http://f1.pg.briefcase.yahoo.com/bc/alborgmd

If you have any problems with it, just let me know...

Regards,
Al
 
Back
Top