X
XMan
I have combo box that I need to put code in OnEnter event. My code is this:
Private Sub cbxSite_Enter()
Dim strSQL As String
strSQL = "SELECT LOCATIONS_WITHIN.LOCATION_WITHIN_UI,
LOCATIONS.DESCRIPTION "
strSQL = strSQL & "FROM LOCATIONS_WITHIN INNER JOIN LOCATIONS ON
LOCATIONS_WITHIN.LOCATION_SUB_UI = LOCATIONS.LOCATION_UI "
strSQL = strSQL & "WHERE LOCATIONS_WITHIN.LOCATION_TOP_UI = " &
Me!cbxSite.Column(0) & " "
strSQL = strSQL & "ORDER BY LOCATIONS.SORT_ORDER, LOCATIONS.DESCRIPTION"
Me.Parent!frmImpactUnit.Form!cbxUnit.RowSource = strSQL
End Sub
When form starts up, this event is triggered and I've got error on this code
saying no object reference there
Me.Parent!frmImpactUnit.Form!cbxUnit.RowSource = strSQL
How can I check for form loading and not run this code? TIA.
Private Sub cbxSite_Enter()
Dim strSQL As String
strSQL = "SELECT LOCATIONS_WITHIN.LOCATION_WITHIN_UI,
LOCATIONS.DESCRIPTION "
strSQL = strSQL & "FROM LOCATIONS_WITHIN INNER JOIN LOCATIONS ON
LOCATIONS_WITHIN.LOCATION_SUB_UI = LOCATIONS.LOCATION_UI "
strSQL = strSQL & "WHERE LOCATIONS_WITHIN.LOCATION_TOP_UI = " &
Me!cbxSite.Column(0) & " "
strSQL = strSQL & "ORDER BY LOCATIONS.SORT_ORDER, LOCATIONS.DESCRIPTION"
Me.Parent!frmImpactUnit.Form!cbxUnit.RowSource = strSQL
End Sub
When form starts up, this event is triggered and I've got error on this code
saying no object reference there
Me.Parent!frmImpactUnit.Form!cbxUnit.RowSource = strSQL
How can I check for form loading and not run this code? TIA.