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

Using 2 conditions in a Macro

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
For simplication, assume that I have 3 fields in a form.<br>Field 1 is a Date field.<br>Field 2 is a Text field.<br>Field 3 is a Date field.<br><br>I want to have the entry in Field 1 put in Field 3 when the date is later than the date in Field 1 but only if Field 2 is null, and otherwise Field 3 will remain blank. I also want the entry in Field 3 to be placed back in the related Table.<br><br>I have tried Iif logic in the control for Field 3, but can't get it to work with two conditions. Maybe I haven't got the syntax correct. I can get it to work with one condition - testing for when the Date is later than that in Field 1, but even then it won't populate back into the Table.<br><br>So, I tried a macro. I can get the macro to work fine with the one condition, and it populates the table just fine...but I can't get it to work with 2 conditions.<br>e.g. Iif [Forms]![Field1] And (IsNull[Forms]![Field2]) etc.<br><br>Solution, anybody?<br>Thanks.<br>Tom
 
If the field 3's control source is correct then this should work<br>=IIf(IsNull([field2]) And Date()&gt;[Field1],[field1],&quot;&quot;)<br>this assumes you meant today when you said &quot;Field 3 when the date is later than the date&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top