IIF satement in a form


D

darren

Hi

I want to write an IIf statement in a form that returns a YES or NO when
comparing values from 2 tables

For example

if the value in field1 of table1 equals the value in field1 of table2 return
YES otherwise return NO

Table2 is linked to the form with the iif satement, the value from the iif
statment goes in field2 of Table2

Darren
 
Ad

Advertisements

G

golfinray

in a textbox on the control source, type
=IIF([table1.filed1]=[table2.field2],"yes","no")
 
D

darren

Thanks for this,

the IIf statement returned #Name?

Do you have any suggestion to why

golfinray said:
in a textbox on the control source, type
=IIF([table1.filed1]=[table2.field2],"yes","no")
--
Milton Purdy
ACCESS
State of Arkansas


darren said:
Hi

I want to write an IIf statement in a form that returns a YES or NO when
comparing values from 2 tables

For example

if the value in field1 of table1 equals the value in field1 of table2 return
YES otherwise return NO

Table2 is linked to the form with the iif satement, the value from the iif
statment goes in field2 of Table2

Darren
 
B

BruceM

If both tables are part of the Record Source for the form (via a query)
there is no need to specify the table, and in fact the syntax may not work.
In fact, I'm pretty sure it will not, since table1.field1 is surrounded by
one set of square brackets, and therefore is in the expression as a field,
but field names cannot contain periods, and in any case table1.field1 is not
the field name.

If table1 and table2 are not in the Record Source, there needs to be a way
to specify which records you are comparing.

To the OP, in what way is table2 linked to the form with an IIf statement?

golfinray said:
in a textbox on the control source, type
=IIF([table1.filed1]=[table2.field2],"yes","no")
--
Milton Purdy
ACCESS
State of Arkansas


darren said:
Hi

I want to write an IIf statement in a form that returns a YES or NO when
comparing values from 2 tables

For example

if the value in field1 of table1 equals the value in field1 of table2
return
YES otherwise return NO

Table2 is linked to the form with the iif satement, the value from the
iif
statment goes in field2 of Table2

Darren
 
Ad

Advertisements

G

golfinray

You may have to do it in a query if that won't work.
--
Milton Purdy
ACCESS
State of Arkansas


darren said:
Thanks for this,

the IIf statement returned #Name?

Do you have any suggestion to why

golfinray said:
in a textbox on the control source, type
=IIF([table1.filed1]=[table2.field2],"yes","no")
--
Milton Purdy
ACCESS
State of Arkansas


darren said:
Hi

I want to write an IIf statement in a form that returns a YES or NO when
comparing values from 2 tables

For example

if the value in field1 of table1 equals the value in field1 of table2 return
YES otherwise return NO

Table2 is linked to the form with the iif satement, the value from the iif
statment goes in field2 of Table2

Darren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top