Hi all,
I am wondering-I have a form 'FrmData' linked to a table-'TblData'. On this form are textboxes and comboboxes for entering various information such as name, date etc. A combobox on the form ‘ComboColour’ has a dropdown list of several options. E.g.
‘Reason1-Red’
‘Reason2-Blue’
‘Reason3-Green’
This is linked to the TblDataField [Reason]. When the fields are filled, FrmData has a button ‘Command31’ which on_click, opens a report ‘RejectReport’ based on the data entered.
Could I code for a different report, say ‘RejectReport2’ to open, if the selection in ComboColour was ‘Reason1-Red’? I am looking at an if-then-else loop, but I am not sure how to link a selection from one control to the action of another. I’ve started with:
I can see that the declaration is in the wrong place, but coding is not my forte and I am unsure what to do. Any pointers?Code:Private Sub Command31_Click() Dim Reason as String If Reason=" Reason1-Red " then DoCmd.openReport "RejectReport2", acPreview Else DoCmd.OpenReport "RejectReport", acPreview End If End Sub
Thanks,
Mattbro