G
Guest
I am trying to figure out how to add a button to a form that will print two
different reports based on the record data. The field values are either C or
D (the ones I am concerned with), I have confirmed the field Type is text.
Both reports can be printed using a seperate print function, but I would much
rather take the human error out of the problem.
Private Sub btnLayout_Click()
On Error GoTo Err_btnLayout_Click
Dim stDocName As String
Dim stDocName1 As String
stDocName = "rptLabel03"
stDocName1 = "rptLabel02"
If Me.Type = "C" Or Me.Type = "D" Then
DoCmd.OpenReport stDocName, acNormal, , Me.OpenArgs
Else
DoCmd.OpenReport stDocName1, acNormal, , Me.OpenArgs
End If
DoCmd.Close acForm, "frmLabelSel"
Exit_btnLayout_Click:
Exit Sub
Err_btnLayout_Click:
MsgBox Err.Description
Resume Exit_btnLayout_Click
Every change I have tried to make, I get the second report, not the first.
Help?!
different reports based on the record data. The field values are either C or
D (the ones I am concerned with), I have confirmed the field Type is text.
Both reports can be printed using a seperate print function, but I would much
rather take the human error out of the problem.
Private Sub btnLayout_Click()
On Error GoTo Err_btnLayout_Click
Dim stDocName As String
Dim stDocName1 As String
stDocName = "rptLabel03"
stDocName1 = "rptLabel02"
If Me.Type = "C" Or Me.Type = "D" Then
DoCmd.OpenReport stDocName, acNormal, , Me.OpenArgs
Else
DoCmd.OpenReport stDocName1, acNormal, , Me.OpenArgs
End If
DoCmd.Close acForm, "frmLabelSel"
Exit_btnLayout_Click:
Exit Sub
Err_btnLayout_Click:
MsgBox Err.Description
Resume Exit_btnLayout_Click
Every change I have tried to make, I get the second report, not the first.
Help?!