Option Group question

C

cinnie

hi

I'm trying to get code to work for my very first option group, but am
getting frustrated. I'd really appreciate a few pointers.

I have an unbound form with an option group, opgPrintOptions. The choices
are Active, Not Active, All, with values 1,2,3 respectively. A command
button on the form, cmdPrintReport, is then clicked to print the report
rptTeacherList. This report has a Yes/No field called ActiveStatus.

If 1 is selected, I want to print the report having rows with ActiveStatus =
Yes. Choices 2 should print the report only for teachers not active. Choice
3 prints the entire report. If someone could rough out the correct
approach, it would really help.
 
R

Rick Brandt

cinnie said:
hi

I'm trying to get code to work for my very first option group, but am
getting frustrated. I'd really appreciate a few pointers.

I have an unbound form with an option group, opgPrintOptions. The
choices are Active, Not Active, All, with values 1,2,3 respectively.
A command button on the form, cmdPrintReport, is then clicked to
print the report rptTeacherList. This report has a Yes/No field
called ActiveStatus.

If 1 is selected, I want to print the report having rows with
ActiveStatus = Yes. Choices 2 should print the report only for
teachers not active. Choice 3 prints the entire report. If someone
could rough out the correct approach, it would really help.

Select Case Me!opgPrintOptions
Case 1
DoCmd.OpenReport "rptTeacherList", acViewPreview,,"ActiveStatus = 'Yes'"
Case 2
DoCmd.OpenReport "rptTeacherList", acViewPreview,,"ActiveStatus = 'No'"
Case 3
DoCmd.OpenReport "rptTeacherList", acViewPreview
End Select
 
C

cinnie

thanks Rick

I had everything except the single and double quotes around "ActiveStatus =
'Yes'". I appreciate the help.
 

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

Similar Threads


Top