Help! IF THENs in Forms...should it be a module?

AlfredNor

Registered User.
Local time
Today, 19:46
Joined
Sep 18, 2002
Messages
47
Heres my problem...

I have a number field that I need to have a value based on the comparison of two other variables. Keep in mind each of these variables is a FIELD on the form.

Eg. If A > B then C (this field)= D+1

Ive tried editing the Control Source (making an expression) and putting in an IF THEN but I guess im not writing it correctly. If also tried to use an IF(logic_test,value_true,value_false) but that gives some #name error message. SHOULD this be a VBS Module??

Basically Im comparing dates (but since im not good with dates, per se..im using numbers which the people using the program will recognize as corresponding to months)

Can anyone help me? IM REALLY in a quandry. It'd be MUCH appreciated.



(The long explanation is:

IF [Referral Date] > [Bill Date] THEN [Application Month]=[Referral Month] +1 but IF >= [Bill Date] [Application Month]=[Referral Month]

(where all these [x] fields are just numbers. (pant) (pant) (pant)
 
You wrote
<<
If also tried to use an IF(logic_test,value_true,value_false) but that gives some #name error message.
>>

Try "IIF" instead. You can use it in the ControlSource property as per your example.

RichM
 
Now getting a #error

Putting THIS :

=IIf([Referral_Received_Day_1]>[Bill_DAY],[Application_Applied_Month_1]=([Referral_Received_Month_1]+1),[Application_Applied_Month_1]=[Referral_Received_Month_1])

in the control source yields a new error: #Error

Any thoughts?
 
If you are entering this in the control source for the field named Application_Applied_Month_1, then maybe something like the following will work for you.

=IIf([Referral_Received_Day_1]>[Bill_DAY],_
[Referral_Received_Month_1]+1),[Referral_Received_Month_1])

Regards,
Tim
 
you wrote
>>
=IIf([Referral_Received_Day_1]> [Bill_DAY],[Application_Applied_Month_1]=([Referra
l_Received_Month_1]+1),[Application_Applied_Month_
1]=[Referral_Received_Month_1])
>>

In the truepart and falsepart, you don't want anything on the left side of the "="

You want something like
=IIf([Referral_Received_Day_1]> [Bill_DAY],([Referra
l_Received_Month_1]+1),[Referral_Received_Month_1])

This goes in the Control Source property of what I assume is a text box called Application_Applied_Month1

RichM
 
Please don't post under multiple topics, you now have two threads with identical answers
 
sorry

Im sorry. I double posted because I wasnt sure which of two avenues to pursue. Accept my apoloogies.

I took the formula you gave me and posted it, but am getting a "#Name" error...is that because one of the field names in the formula is incorrect?

Edit: I re-inserted the right fields and it worked! Thanks!!!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom