Firstly, Date is a reserved word, so will give you grief. I'll assume you
have changed the name to something like ClinDate.
Secondly, if you match each subform like that based on the month, any record
where ClinDate is null will disappear (not show in any subform.) To avoid
this, you might want to set the Required proeprty to Yes for this field
(bottom pane of table design.)
Next, you want all the January events in the first subform, the Feb ones in
the second, and so on. I wonder if you've thought about how this will look
after a couple of years? You will have the January 2008, 2009, and 2010
appointments in the first subform together? I'm not sure that's a great
idea.
Create a query using tbl_Clinician.
Type an expression like this into the Field row:
TheMonth: Month([ClinDate])
This returns 1 for Jan, 2 for Feb, and so on.
Save the query.
Set the RecordSource of your subfom to this query.
On your main form, add a text box with these properties:
Control Source =1
Name txtMonth1
Visible No
The first subform control will have properties like this
Link Master Fields [ClientID]
Link Child Fields [ClientID]
Add another to the end of these properties to filter the month as well, so
it becomes:
Link Master Fields [ClientID]; [txtMonth1]
Link Child Fields [ClientID]; [TheMonth]
This subform now filters for January.
Create a second text box named txtMonth2, with ControlSource =2, and so on
for the remaining months.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Radhika said:
I am creating a database that uses a combo box for the filed 'Date' in a
table called 'tbl_Clinician'. I have created a form called 'frm_Clincian'
that consists of 12 pages with 12 subforms, one for each month of the
year.
Each subform comes from the same table 'tbl_Clinician'. However, I want
the
'Date' drop down box to display only the dates for each month in each
months'
subform. The Dates must still be stored in the same table 'tbl_Clinician'.
How can I go about doing this. Is there an IIf statement i can write in a
query?