Automatically select choice of report

saintsman

Registered User.
Local time
Today, 16:47
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.
 
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
 
Thanks Col, Just what I needed.
 

Users who are viewing this thread

Back
Top Bottom