IIf function

  • Thread starter Thread starter Emmy
  • Start date Start date
E

Emmy

I have a combo box on a form and based on the choice, I
need to open different reports. Can this be done?

Ex) If I pick "Manager Changed" from the drop down list,
I want to open the report rptManagerChanged. If I
pick "Address Changed" from the drop down list, I want to
open the report rptAddressChanged.

If this can be done, can someone show me an example or
tell me where to look to find this information since I'm
not very experienced writing in code.

Thanks!
Emmy
 
I have a combo box on a form and based on the choice, I
need to open different reports. Can this be done?

Ex) If I pick "Manager Changed" from the drop down list,
I want to open the report rptManagerChanged. If I
pick "Address Changed" from the drop down list, I want to
open the report rptAddressChanged.

If this can be done, can someone show me an example or
tell me where to look to find this information since I'm
not very experienced writing in code.

Thanks!
Emmy

Ok, there is a number of ways to do that.

Heres a tricky/easier one.

Create a table, give it two fields
field one is the name of the report
field 2 is the name you want displayed in the combobox

now, make sure the rowsource type of the combobox is
table/query not value list or something.

make the rowsource = SELECT field1,field2 FROM table

change the column count to 2
change the bound column to 2
go to the column width box,
and type in 0";1" <- that second value can be whatever you want the width
to be.

still with me? :-)
don't worry not much left and no code yet!
now in the button on click event or the After_Update of the combobox
(however you decided to lay your form out)
write this:
'assumes cbName is your combobox
if (not cbName.Column(0) = "") and (not IsNull(cbName.Column(0))) Then
DoCmd.OpenReport cbName.Column(0),acPreview
End If

and if you have a switchboard already that points to all your reports,
you don't even have to make a table, just use that one, with a where clause
to select only the report.

I'm on fire :p

hope that helps

-mwalts
 

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

Back
Top