Calendar date into a query

G

Guest

I would like to make a form showing a calendar with a subform underneath that
displays the results of a query. The criteria for the query would be the date
highlighted on the calendar - each time a new date was selected the query
subform would change to show the records for that date. Totally stuck with
how to call the date and whether to put the code on the form or the subform.
Any help much appreciated.
 
G

Guest

Hi Shona

To requery subform based on calendar in main form.

Put a calendar on your main form (use the wizard if needed)
Create a new box called txtDate
The record source of the box is
=[CalendarName]

Create a button call something
The OnClick event of the button would be

Private Sub ButtonName_Click()
Me.SubFormName.Requery
End Sub

Save form

Open the query that the subform is based on
In the date column put this
Forms![FormName]![txtDate]

Click the button to see the results of the calendar shown on the sub form data

good luck
 
G

Guest

Hi Wayne - thanks for that - I've given it a try but for some reason the
txtbox doesn't update as I click on the calendar - any ideas as to why this
could be

also - if I can get that to work - could I put the requery onto one of the
calendar events rather than a button so that it just updates as the calendar
is clicked?

many thanks again
 
G

Guest

Don't worry - it's as the access calendar control is a little strange.

Make the text box hidden (thats what do). It will update when you set focus
to something else on the form, like the new button I suggested.
 

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