Access report on records selected by VBA

  • Thread starter Thread starter New Guy Dan
  • Start date Start date
N

New Guy Dan

Hello,
I have an Access table with a "birthday" field and need a
report that has birthdays in a given range. On a form I
enter a month and day (2 fields) and another month and
day (2 fields) which will be the range I want to select
records on.
I then have a procedure that reads in each record then
uses the DatePart("y", birthday) function (and other
stuff for leap years, blank dates, etc.)to determine if
the record's birthday field is between the dates entered
on the form.
The procedure works perfectly.
The problem is I don't know how to send the "good"
records to an Access report.
Should (can?) a report use a proc as it's source? How
would it be done?
Should the "good" records be sent to a file and
then "force" an Access report to take it?
Am I doing the whole thing the long way and there is a
much simpler way?
Many, many thanks to everyone who can give me an idea of
what to do next. I especially would appreciate examples.
Dan
 
I have always setup a query with parameters as the source
of my report. I then build a form like what you have
done.

When the user presses the 'go' button on the form after
making selections, I use VBA to substitute the parameters
on the query with the info the user has selected. Then I
simply fire off the report with a 'cmd'.

Hope this helps.

Vicki
 
Appreciate the answer and that's what I tried and then
remembered that the year must be ignored. Only the month
and day are to be considered.
Dan
 
Back
Top