opening a form and using a select query

D

Dolphin_Hwii

I have a subform for registering people into courses we hold. As my database
is expanding rather rapidly I am trying to enter a date in one field and have
another field use that date to search my query and only bring up the sessions
that are for that date.

The way I have got it set up now is that the form asks for the date on
opening and only displays those dates. I cannot go to the next record and put
in a new date and get these sessions on the next from.
 
O

Ofer

I can give you two options:
1. create a field in your main form where you enter a date, in the subform
record source you write a query with reference to the field in the main form.
Select * Form MyTable Where DateField = Forms![MainFormName]![DateFieldName]
on the after update of the date in the main form you write:
me.SubFormName.requery

2. on the after update of the date field you create in the main form, you
assign a new record source to the sub form changing the date
if not isnull(me.[DateFieldName]) then
me.subformName.Form.RecordSource = "Select * Form MyTable Where
DateField = #" & me.[DateFieldName] & "'"

end if
 
Top