I have to found out which combo box the user has choosen. I use 4 combos + two text fields.
The easy solution is that you have to choose only one combo at a time, but I the user should choose several at the same time before they click "Make report".
Heres the code: (I use global variables, defined in Module)
And I am testing a iftest with more statements, how to choose more than one?
I hope someone do have som tips on this
Thanks in advance
The easy solution is that you have to choose only one combo at a time, but I the user should choose several at the same time before they click "Make report".
Heres the code: (I use global variables, defined in Module)
Code:
Private Sub Combo21_Change()
kombo1test = True
End Sub
Private Sub Combo23_Change()
kombo2test = True
End Sub
Private Sub Combo5_Change()
kombo3test = True
End Sub
Private Sub Combo7_Change()
kombo4test = True
End Sub
Private Sub Command14_Click()
On Error GoTo Err_Command14_Click
Dim stDocName As String
'Start If test
'Åpner rapport basert på saksansvarlig OK
If (kombo1test = True) Then
DoCmd.OpenReport "Ansvarlig", acPreview, , where
where = "[Feil_problem.ansvarlig]= [Combo21]"
kombo1test = False
'Åpner rapport basert på system OK
ElseIf (kombo2test = True) Then
DoCmd.OpenReport "System", acPreview, , where
where = "[Feil_problem.system]= [Combo23]"
kombo2test = False
'Åpner rapport basert på fabrikk OK
ElseIf (kombo3test = True) Then
DoCmd.OpenReport "Fabrikk", acPreview, , where
where = "[Feil_problem.fabrikk]= [Combo5]"
kombo3test = False
'Åpner rapport basert på område OK
ElseIf (kombo4test = True) Then
DoCmd.OpenReport "Omraade", acPreview, , where
where = "[Feil_problem.omraade]= [Combo7]"
kombo4test = False
And I am testing a iftest with more statements, how to choose more than one?
Code:
ElseIf (kombo1test = True And kombo2test = True) Then
DoCmd.OpenReport "Saksansvarlig_system", acPreview, , where
where = "[Feil_problem.ansvarlig]= [Combo21] AND [Feil_problem.system]= [Combo23]"
kombo1test = False
kombo2test = False
I hope someone do have som tips on this
Thanks in advance