By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,849 Members | 2,361 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,849 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

Expert Mod 10K+
P: 12,366
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

Expert Mod 10K+
P: 12,366
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

Expert Mod 15k+
P: 31,489
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.