Hi Access VBA Gurus,
I currently have a fully functional SQL Select statement (as shown below) in the RowSource property of an UNbound ComboBox in an Access 2002 form:
SQL
SELECT DISTINCTROW qryKeyAgentAddEditForm.[Key Agent] FROM qryKeyAgentAddEditForm WHERE qryKeyAgentAddEditForm.[Key Agent Type]=cboKeyAgentType.Value ORDER BY qryKeyAgentAddEditForm.[Key Agent];
I need to put in a conditional IF statement to the following effect:
Code
IF condition1 Then
SELECT DISTINCTROW qryKeyAgentAddEditForm.[Key Agent] FROM qryKeyAgentAddEditForm ORDER BY qryKeyAgentAddEditForm.[Key Agent];
ELSE
SELECT DISTINCTROW qryKeyAgentAddEditForm.[Key Agent] FROM qryKeyAgentAddEditForm WHERE qryKeyAgentAddEditForm.[Key Agent Type]=cboKeyAgentType.Value ORDER BY qryKeyAgentAddEditForm.[Key Agent];
ENDIF
Is such a conditional IF condition valid as the RowSource property of an UNBound combo-box in Access VBA?
Many thanks in advance to anyone who can help/advise