I have a combo box that listed the Department Names. I would like to create a
Print View button that will show only the Department which I selected in the
combo box.
Is possible to do that?
Please help.
Thanks
Chi
Chi
> I have a combo box that listed the Department Names. I would like to create a
> Print View button that will show only the Department which I selected in the
[quoted text clipped - 8 lines]
>
> Chi
Here is one method.
Add a command button to your form
Code it's click event:
DoCmd.OpenReport "ReportName", acViewPreview, , "[Department] = '" &
Me![cboDepartment] & "'"
The above assumes that [Department] datatype is Text.
If [Department] is a Number Datatype, then use:
"[Department] = " & Me![cboDepartment]

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Chi - 07 Jun 2006 18:01 GMT
Hi Fred,
Thanks for your respond. I have tried to apply the code to the form.
However, I got the Code Error message. Would you mind checking the code? It
has problem at the end of line. Sorry, I have no experience using the VBA.
Did I respond to the newsgroup? There are two REPLY buttons, so I am not
sure which one I should use.
Thanks
Chi
> > I have a combo box that listed the Department Names. I would like to create a
> > Print View button that will show only the Department which I selected in the
[quoted text clipped - 20 lines]
> If [Department] is a Number Datatype, then use:
> "[Department] = " & Me![cboDepartment]
fredg - 07 Jun 2006 18:21 GMT
> Hi Fred,
> Thanks for your respond. I have tried to apply the code to the form.
[quoted text clipped - 30 lines]
>> If [Department] is a Number Datatype, then use:
>> "[Department] = " & Me![cboDepartment]
Did you change "ReportName" to the actual name of the report you wish
to open?
Did you change [Department] to the actual name of the field in the
report's recordd source?
Did you change [cboDepartment] to the actual name of the combo box on
the form?
Did you use the Text or Number datatype syntax as explained in my
previous message.
A copy of YOUR exact code would have been helpful.

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail