Code problem for self-updating combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The idea of the code is to make a self-updating combo box and it works just
fine until I want to change the entry back to Null.

Then I get Run time error 94 – Invalid use of Null.

This is the code:

Private Sub CboFloor_BeforeUpdate(Cancel As Integer)
Dim strFloor As String
strFloor = Me.CboFloor
If DCount("Floor", "Participant Pool", "Floor = '" & strFloor & "'") = 0
Then
If MsgBox(strFloor & " is not currently in the Floor list, would you
like to add it?", vbYesNo, "Add Floor?") = vbNo Then
Cancel = True
Me.CboFloor.Dropdown
End If
End If
End Sub


Is there a line of code I can add in to remove my problem?

Any help is greatly appreciated.

Mary
 
Also, if it's a required field, null won't be accepted. Check how you've
defined the field in the table.
 
It isn't a require field and zero length strings are allowed in the table
settings. Thanks for the help.
 
Back
Top