Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation Problem

Status
Not open for further replies.

glenmac

Technical User
Jul 3, 2002
947
0
0
CA
Hi I'm trying to validate an option group control on a form. I've tried the following code to no avail and can't see why it doesn't work.

If Me!PuDel = IsNull(Me!PuDel) Then GoTo DataErr
Debug.Print Me!PuDel
DataErr:
MsgBox "The information required is incompete. Please fill in Pickup or Delivery", vbOKOnly, "Data Validation Error"
GoTo Exit_Command66_Click

It brings up the message box and exits the sub but if I do click an option it still does the same thing. I've printed the value of "PuDel" ant it gives me either Null or 1 or 2 depending on what option I choose. But the validation never lets me enter the value.
I've tried &quot;= Not 1 Or Not 2&quot; , &quot;<> 1 Or <> 2&quot;as well. Can anyone help with this problem? All help will be greatly appreciated.
 
Given your code I think you will execute the dataerr no matter what you do. I think your goto exit is in the wrong place.

If IsNull(Me!PuDel) Then GoTo DataErr
Debug.Print Me!PuDel
goto exit_command66_click

DataErr:
MsgBox &quot;The information required is incompete. Please fill in Pickup or Delivery&quot;, vbOKOnly, &quot;Data Validation Error&quot;

Exit_Command66_Click:


 
Nope that doesn't work all it does is close the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top