If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Conditional Formating - Validation
I have 2 fields on the form. If one is filled in, the other one needs to be
as well. However, they both can be blank. Any ideas? |
#2
|
|||
|
|||
Conditional Formating - Validation
You can use the Before Update event of the form to check for this condition:
Warning! Untested Air Code If (IsNull(Me.TextBox1) And Not IsNull(Me.TextBox2)) Or _ (Not (IsNull(Me.TextBox1) And IsNull(Me.TextBox2))) Then Then MsgBox "Both Text Boxes Must Be Filled In" Cancel = True End If "JB" wrote: I have 2 fields on the form. If one is filled in, the other one needs to be as well. However, they both can be blank. Any ideas? |
#3
|
|||
|
|||
Conditional Formating - Validation
Let me introduce you to the wonders of a truth table
Length Length Field1 Field2 Result Action 0 0 VALID No Information Present 0 1 VALID Information missing 1 0 VALID Information missing 1 1 VALID Information present From there just build your If...Thens as in If Len(Field1) = 0 AND Len(Field2) = 0 Then If (Len(Field1) = 0 AND Len(Field2) 0) OR (Len(Field1) 0 AND Len(Field2) = 0) Then If Len(Field1) 0 AND Len(Field1) 0 Then In this situation, I assumed that the validation is simple in that the a character is in either field. If the validation criteria is different, adapting the above, shouldn't be that difficult. For more on truth tables... http://en.wikipedia.org/wiki/Truth_table David H JB wrote: I have 2 fields on the form. If one is filled in, the other one needs to be as well. However, they both can be blank. Any ideas? |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Conditional formating using formulas | arifnj | Worksheet Functions | 4 | October 27th, 2005 01:56 PM |
VLOOKUP & Conditional Formating Help. | Excel'ed Failures | General Discussion | 6 | August 16th, 2005 04:46 PM |
Conditional validation :-) | Robert | General Discussion | 1 | February 18th, 2005 08:07 AM |
Conditional Formating in Report Header | Haas | Setting Up & Running Reports | 1 | July 21st, 2004 10:50 PM |
Conditional Formating | Brw | Worksheet Functions | 3 | December 9th, 2003 03:12 PM |