Selective report

K

K Crofts

hi. i want users to be able to click a command button on
my form which will then bring up a small form for selction
of two dates. When okay is clicked after entering the
dates teh report will be displayed based on the records
that co-incide with these dates. the date is my primary
key and my recordsource is my table. How do i link these
with code please?
 
J

JulieD

Hi

the basic steps to achieving this are:
1. create the query that the report is to be based on
2. use the report wizard to build a report based on the query
3. create an unbound form (called something like FRM_ReportDates) with
two text boxes on it - one for the start date (call it txtStart) and one for
the end date (txtEnd) - close & save form
4. return to the query, click in the criteria line of the date field type
BETWEEN
5. click on the expression builder icon on the toolbar
6. go to forms / all forms / find FRM_ReportDates form, in the centre
section double click on txtStart up the top type AND and then click on
txtEnd in the middle screen again (leave spaces after the word between and
around the and) - click on the OK button
7. close & save query
8. return to the form & put a command button on it to open the report in
print preview mode - close & save form
9. open form, set criteria, click print button
10. then on your original form put a command button that opens up the
FRM_ReportDates form

Hope this helps - let us know how you go.

Cheers
JulieD
 
Top