Loop

L

Lizo Consulting

Background: I am working on a database to track children who attend a
preschool, which classroom(s) they are assigned to, and which days of
the week they attend. Students can attend any combination of classrooms
or days of the week.

I am currently working on a report that will list the children who
attend on a particular day (it will be used as a sign in sheet by the
parents). The report works great, but I am trying to avoid creating 5
different versions of it (one for each day of the week, where the
"MONDAY report" would show where [mon] = true, etc).

I'm hoping to be more slick and use the one report to programmatically
change the content based on the day of the week (stored in a separate
table).

Key applicable data to this problem are:

Report based on [tblSchedule]
studentID (looks up name & other info in separate table)
classroomID
Mon - y/n
Tue - y/n
Wed - y/n
Thur - y/n
Fri - y/n

There is a separate table [lstWeekdays] that stores the weekdays Monday
- Friday and their associated abbreviations (mon - fri). The "weekdays"
will be displayed on the report header and the abbreviations would be
used to generate the filter for the report (e.g. [mon] = true).

I would appreciate assistance with help with code to loop through my
days of the week table and customize the content shown on the report
based on the day of the week. I am not too proficient with code, but I
do my best. This problem is just too much for me....

Ideally this code will:

1) Loop through the list of weeks & abbreviations from the [lst
weekdays] table
2) Open my report with the filter "where [mon] = true" (I know how to
do this part)
3) Print the day of the week at the top of the report (i assume, by
setting the value of an unbound textbox?)
4) list the children who attend that day of the week (my report already
does this, based on the filter)

Report will be called directly to the printer (though having a preview
might be nice, too)
In the end, I would have printed out 5 copies of the original report,
one for each day of the week....

Any ideas, suggestions? I am pretty experienced with access, but not so
great at heavy duty coding, looping, recordsets etc.

Thanks much in advance for your assistance!
 

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