By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Linking two fields in a single table: If Then statement?

P: 2
This is my first time posting to the forum, so bear with me if this is a simple question...

I have two fields in a table.
Field 1 is a yes/no checkbox.

I would like to set Field 2 up such that it is a required field only if Field 1 is equal to "yes".

Can you help?
Feb 21 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,315
Don't think you can do this from a table. You can using code in a form however.
Feb 21 '07 #2

P: 2
Thanks Rabbit.
Can you help me create this using a form?
I set the form up with field 1 as a yes/no check box and field 2 as a text box. How can I make field 2 a required field if the checkbox in field 1 is checked (i.e. "yes")
Feb 22 '07 #3

Rabbit
Expert Mod 10K+
P: 12,315
In the After Update event of Field 1 you would have:
Expand|Select|Wrap|Line Numbers
  1. If [Field 1] Then [Field 2].SetFocus
In the Lost Focus event of Field 2 you would have:
Expand|Select|Wrap|Line Numbers
  1.  If [Field 1] And Isnull([Field 2]) Then [Field 2].SetFocus
Feb 22 '07 #4

NeoPa
Expert Mod 15k+
P: 31,186
You would need to add the code in the OnCurrent event procedure too.
Feb 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.