simple vba script? open different report depending on input

Sprawl

Database Co-Ordinator
Local time
Today, 14:07
Joined
Feb 8, 2007
Messages
32
Seems simple i would think.

Two reports one for multiple clients, one for just a single client. I want to do it from 1 page, but with one button (for idiot proofing).

The entry page has inputs. a beginning client and an end client. the if statement should check to see if they're the same. if they are, open the single client report, if they're different, open the multiple client report. This is what i've written but it always tells me that there's missing a =
Code:
Private Sub Command11_Click()
IIf([E_CLIENT]=[S_CLIENT], DoCmd.OpenReport("AR - Statement - Single", acViewPreview), DoCmd.OpenReport("AR - Statement", acViewPreview))
End Sub
 
Code:
IF Me!E_CLIENT=Me!S_CLIENT Then
   DoCmd.OpenReport "AR - Statement - Single", acViewPreview
Else
   DoCmd.OpenReport "YourOtherReportNameHere", acViewPreview
End If
 
Last edited:
boblarson.

as always you're quick to respond and respond you do with the correct solution

Thanks again!
 
Or, all in one line (and because I like switches over If..Then statements):

Code:
DoCmd.OpenReport Switch(Me!E_Client=Me!S_CLIENT,"AR - Statement - Single", True, "YourOtherReportNameHere"), acViewPreview
 

Users who are viewing this thread

Back
Top Bottom