G
Guest
Working from the code suggested in the MSOffice Online article "Basing one
combo box on another"
(http://office.microsoft.com/en-us/assistance/HA011730581033.aspx) I have
this piece of code which displays an initial value in a combobox on a main
form:
Private Sub Form_Load()
If IsNull(cboPrimaryID) Then
Me.cboPrimaryID = Me.cboPrimaryID.ItemData(0)
End If
End Sub
But I also want similar behaviour in a combobox on a subform. I think the
code to do this should probably be:
Private Sub Form_Load()
If IsNull(Me!sfrOrderDtls.Form!cboCatalogID) Then
Me!sfrOrderDtls.Form!cboCatalogID =
Me!sfrOrderDtls.Form!cboCatalogID.ItemData(0)
End If
End Sub
What I don't know is just where to put this second piece of code. Exactly
where should I add it (all of it? - all except the first and last lines?) to
the first piece of code so that the main form's OnLoad event will perform
both the actions?
combo box on another"
(http://office.microsoft.com/en-us/assistance/HA011730581033.aspx) I have
this piece of code which displays an initial value in a combobox on a main
form:
Private Sub Form_Load()
If IsNull(cboPrimaryID) Then
Me.cboPrimaryID = Me.cboPrimaryID.ItemData(0)
End If
End Sub
But I also want similar behaviour in a combobox on a subform. I think the
code to do this should probably be:
Private Sub Form_Load()
If IsNull(Me!sfrOrderDtls.Form!cboCatalogID) Then
Me!sfrOrderDtls.Form!cboCatalogID =
Me!sfrOrderDtls.Form!cboCatalogID.ItemData(0)
End If
End Sub
What I don't know is just where to put this second piece of code. Exactly
where should I add it (all of it? - all except the first and last lines?) to
the first piece of code so that the main form's OnLoad event will perform
both the actions?