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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requiring Fields based upon entry in a nother field

Status
Not open for further replies.

dannyocean

Technical User
Jan 26, 2001
136
US
Hello All,


I am needing to make certain fields required in my form based upon the answer in another field.

EX. Market Field = Arizona Make Zip Code require an entry.

Thanks in advance,

Danny
 
Fields are found in tables

CONTROLS appear on Forms.


You can make FIELDS Required ( or Not )
You cannot make Controls Required

However, you can write some code in the Form's UnLoad event that will check to see if the data rules are satisfied and then CANCEL the Unload if they are not.

Eg
Private Sub Form_UnLoad(Cancel As Integer)
If Market = "Arizona" And IsNull(ZipCode) Then
Cancel = False
MsgBox " There must be a valid ZipCode for Arizona addresses."
End If

End Sub


'ope-that-'elps.

G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top