Form_BeforeUpdate(Cancel As Integer)

MysticElaine

Registered User.
Local time
Today, 12:41
Joined
May 26, 2014
Messages
24
Hello,

I have this code

Code:
If IsNull(Me.Providers) Then
     Cancel = True
     MsgBox "Enter a Provider!"
End If

in the beforeupdate event. I don't think it is working properly because it is a combo box, as I have the exact same code for a textbox that works fine. Even if I choose a name from the dropdown list, it still pops up the msgbox and won't save.

Any suggestions? Thanks :)
 
I tend to use this when trying to determine if a combo box has a value.
Code:
If nz(Me.Providers,"") = "" Then
     Cancel = True
     MsgBox "Enter a Provider!"
End If

Works for both a NULL value and empty string.

Also, is this in the form's before update event or the combo box's before update? I think it needs to be in the combo box's before update event.
 
Last edited:
Thanks for the reply. I tried it and it didn't work :( The msgbox still pops up after having the combo filled.

Edit: It seems like my project is borked as I deleted the entire code for the combo and the project still acted as if the code was there and kept giving the msgbox message. Anyways, I pulled up a backup saved file and redid the code with the Nz and it works. So I don't know what happened to my other version :confused: but I think the problem of my combo is fixed. Thanks for the reply.:D
 
Last edited:

Users who are viewing this thread

Back
Top Bottom