Automatically select choice of report (1 Viewer)

saintsman

Registered User.
Local time
Today, 03:16
Joined
Oct 12, 2001
Messages
138
I am having trouble getting some reports printed. Depenedent on a certain field value I want either two reports printed or three reports printed. My reports are currently selected for print in two macros (2 reports in one and three in the other).

How do I select which one I need?

This is what I've tried but it does not allow options:

Private Sub Command1_Click()
If [Forms]![Form-1]![Field-1].Value = "Yes" Then
DoCmd.RunMacro.Macro -1, acNormal
Else
DoCmd.RunMacro.Macro -2, acNormal
End If

End Sub

As ever, help is very much appreciated.
 

ColinEssex

Old registered user
Local time
Today, 03:16
Joined
Feb 22, 2002
Messages
9,118
If the button is on the form that has the relevant field in it you can try this.

If Me.FieldName = "Yes" Then
DoCmd.RunMacro "MacroNameHere"
else
DoCmd.RunMacro "OtherMacroNameHere"
End If

Col
 

saintsman

Registered User.
Local time
Today, 03:16
Joined
Oct 12, 2001
Messages
138
Thanks Col, Just what I needed.
 

Users who are viewing this thread

Top Bottom