Originally Posted by
OBP
Use the Combo bx's listcount property
cboComponent.listcount
OBP, that works BUT not fully. What I mean is ok there are 11 choices for the combo box and if I stayed on the page and chose all 11 there won't be any choices left and there wouldn't be a new record because of the code BUT if I close the form and go back then there is a new last record in my continuous form. How do I fix that from happening?
Private Sub cboComponent_Dirty(Cancel As Integer)
If cboComponent.ListCount > 1 Then
Cancel = True
Else
Me.AllowAdditions = False
End If
End Sub
Here is a VBA string that would be the same that's in the combo box.
strSql = "SELECT ComponentID, Component FROM tbl_Components " & _
" WHERE ComponentID Not In (Select ComponentID from tbl_ComponentParts where ProductID = " & Me.Parent.cboProduct & ") " & _
" AND IsInactive = False"