How can I make a field dependant on other fields?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 fields Partswarranty,laborwarranty, and extended warranty as check
boxes. I have other fields that I want to make mandatory(required) if any of
the warranty boxes are checked. Any help would be greatly appreciated.
 
I have 3 fields Partswarranty,laborwarranty, and extended warranty as check
boxes. I have other fields that I want to make mandatory(required) if any of
the warranty boxes are checked. Any help would be greatly appreciated.

You can use a Table Validation rule - view the table properties. The
validation rule is a logical expression which must evaluate to TRUE
for the record to be accepted.

It may be easier on both you and the user to enforce these business
rules using VBA code on a Form, however; for example, in the Form's
BeforeUpdate event you could have code like

Private Sub Form_BeforeUpdate(Cancel as Integer)
If Me![partswarrenty] Then ' did user check this box?
If IsNull(Me!txtPartsWarrentyTerm) Then
MsgBox "Please fill in term of the parts warrenty", vbOKOnly
Cancel = True ' don't update the record until corrected
Me!txtPartsWarrentyTerm.SetFocus
End If
<etc etc>

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top