Hi,
I am trying to use 4 combo boxes to allow users to create and print a report. If combox 2,3 and 4 is null then it will print Report1(has only 1 column), if 3 and 4 are null then it will print Report2 (2 columns) otherwise it will print Report4 (4 columns)
I am trying to use an if statement to decide which report to print depending upon the PRep value.
I have tried many variations in my code for the on click print button, however this is the one that I am seeing as most sense, however I am missing something as it keeps generating errors.
UG added Code Tags
Hope this makes some sense, please help as this has been driving me mad for weeks!!
Malcolm
I am trying to use 4 combo boxes to allow users to create and print a report. If combox 2,3 and 4 is null then it will print Report1(has only 1 column), if 3 and 4 are null then it will print Report2 (2 columns) otherwise it will print Report4 (4 columns)
I am trying to use an if statement to decide which report to print depending upon the PRep value.
I have tried many variations in my code for the on click print button, however this is the one that I am seeing as most sense, however I am missing something as it keeps generating errors.
UG added Code Tags
Code:
If IsNull(Me.Text4) Then PRep = "4"
Else
If IsNull(Me.Text3 And Me.Text4) Then PRep = "2"
Else
If IsNull(Me.Text4 And Me.Text3 And Me.Text2) Then PRep = "1"
Else
PRep = "4"
End If
After the PRep number has been generated then it will select the report using code something like below:
Select Case Me.PRep
Case "1"
StrDocument = "Report1"
Case "2"
StrDocument = "Report2"
Case "4"
StrDocument = "Report4"
End Select
DoCmd.OpenReport StrDocument, acNormal
Hope this makes some sense, please help as this has been driving me mad for weeks!!
Malcolm
Last edited by a moderator: