My application is
Microsoft Access front end
MySql back end
Code is in vb
I am trying to modify a form that has a few drop down fields [![enter image description here][1]][1]. I need it to require the jobcustomerID before updating. Right now if i add an address first it will tell me to add the customer but gives me an error for "invalid use of null"
Current Code
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.JobCustomerID) Or Me.JobCustomerID = "" Then
Call MsgBox("You must select a Customer from the list provided", vbExclamation, "REQUIRED ENTRY")
Me.JobCustomerID.SetFocus
Cancel = True
Exit Sub
End If
End Sub
I do have an image of the fields but lack the reputation needed
Try moving the cancellation to the front.
If IsNull(Me.JobCustomerID) Or Me.JobCustomerID = "" Then
Cancel = True
MsgBox "You must select a Customer from the list provided", vbExclamation, "REQUIRED ENTRY"
Me.JobCustomerID.SetFocus
Exit Sub
End If
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.