Scenario:
I have a form that 1. USER makes a selection & 2 based on that selection(using a option group) a report is generated.
I have used code to make the 2nd bit occur but the i want to cover the scenario when a user DOESNT make the first selection but makes the second selection and gets an access message(whch some users might freak about).
So what i want to check is, when the control to make the first selection, has not been used ie. when it is mt. but i am not sure where to start with this.
As i have only just started using code, please excuse the methodology displayed and i would welcome any suggestions as how to tidy it up(Like nesting statements etc) although currently this little routine is working quite nicely, but you know, we forever fiddle to tidy things up.
see current code below
Private Sub PreviewOptionGp_Click()
Dim DocName1 As String
Dim DocName2 As String
Dim DocName3 As String
DocName1 = "rCatalogue"
DocName2 = "rGalleryLabels"
DocName3 = "fPreview_Cat_Labels"
'(in here i need a routine to check if the control "ExhibitionName" is mt)
If Me.PreviewOptionGp = 1 Then
DoCmd.OpenReport DocName2, acViewPreview, , "ExhibitionName=" & ExhibitionSelect
DoCmd.Close (acForm), DocName3
Else
If Me.PreviewOptionGp = 2 Then
DoCmd.OpenReport DocName1, acViewPreview, , "ExhibitionName=" & ExhibitionSelect
DoCmd.Close acForm, DocName3
Else
If Me.PreviewOptionGp = 3 Then
DoCmd.CancelEvent
DoCmd.Close (acForm), DocName3
End If
End If
End If
End Sub
I have a form that 1. USER makes a selection & 2 based on that selection(using a option group) a report is generated.
I have used code to make the 2nd bit occur but the i want to cover the scenario when a user DOESNT make the first selection but makes the second selection and gets an access message(whch some users might freak about).
So what i want to check is, when the control to make the first selection, has not been used ie. when it is mt. but i am not sure where to start with this.
As i have only just started using code, please excuse the methodology displayed and i would welcome any suggestions as how to tidy it up(Like nesting statements etc) although currently this little routine is working quite nicely, but you know, we forever fiddle to tidy things up.
see current code below
Private Sub PreviewOptionGp_Click()
Dim DocName1 As String
Dim DocName2 As String
Dim DocName3 As String
DocName1 = "rCatalogue"
DocName2 = "rGalleryLabels"
DocName3 = "fPreview_Cat_Labels"
'(in here i need a routine to check if the control "ExhibitionName" is mt)
If Me.PreviewOptionGp = 1 Then
DoCmd.OpenReport DocName2, acViewPreview, , "ExhibitionName=" & ExhibitionSelect
DoCmd.Close (acForm), DocName3
Else
If Me.PreviewOptionGp = 2 Then
DoCmd.OpenReport DocName1, acViewPreview, , "ExhibitionName=" & ExhibitionSelect
DoCmd.Close acForm, DocName3
Else
If Me.PreviewOptionGp = 3 Then
DoCmd.CancelEvent
DoCmd.Close (acForm), DocName3
End If
End If
End If
End Sub