Hi all,
I've got a bit of VBA code that looks at a field cboCompanyID in my form and if that field is blank is left blank and the user tries to save, they get a message saying "Please Enter a Customer"
ElseIf Me.cboCompanyID = "" Or IsNull(Me.cboCompanyID) Then
MsgBox "Please Enter a Customer", vbInformation, "Incomplete Data"
Me.cboCompanyID.SetFocus
Exit Sub
Else
DoCmd.RunCommand acCmdSaveRecord
Now I've created another field, Me.cboTargetCustomer as an alternative option. What I'm aiming for is for users to choose between the two fields. They would only get the "Please Enter a Customer" message if both fields are left blank.
My attempt below is not doing what I need. If one of the fields is blank but the other isn't, the message still pops up.
ElseIf Me.cboCompanyID = "" Or IsNull(Me.cboCompanyID) And Me.cboTargetCustomer = "" Or IsNull(Me.cboTargetCustomer) Then
MsgBox "Please Enter a Customer", vbInformation, "Incomplete Data"
Me.cboCompanyID.SetFocus
Exit Sub
Else
DoCmd.RunCommand acCmdSaveRecord
Any help is appreciated.
Thank you