View Full Version : Calculated Field Using If


Rich_Lovina
05-15-2001, 06:16 PM
I have three fields in a form which I want to yeild a fourth field result, based upon text data entered in 1,2 and 3, such that:

Field1=CM, Field2=DM, Field3=NM, or
Field1=CM, Field2=NM, Field3=NM.
or Field1=CM, Field2=DM, Field3=' '
I want the result in GlobalField to run with Field3 always, if not blank, then if blank use Field2, and if 3 and 2 are blank, then use Field1.

Where do I enter the formula and what is it?

charityg
05-15-2001, 10:04 PM
if field3<> "" then
globalfield="whatever"
elseif field2<>"" then
globalfield="whatever"
endif
else
globalfield="whatever"
endif

put this code in the oncurrent event of the form and also in the afterupdate events of fields1,2, and 3. There is probably a slicker way to do this, but this should work. Not guaranteed bugfree (I'm not 100% sure about the elseif line) but you get the idea.