Conditional Query

  • Thread starter Thread starter Frank Lim
  • Start date Start date
F

Frank Lim

Dear all

I wish to compare 2 field data, to verify if those data is equal.

The expression i wrote is : IIf(first!MRR=first![MRR In USD],"yes","no")

The comparison is between Field MRR with MRR in USD.

I hope this type of query is possible in Access.

Thank you so much for your assistance.

Frank Lim
 
Frank,
What is "first?" Is it the name of the open form where the two text
controls are located?

If you are on a form, and want to compare 2 text controls on that
form...
=IIF([MMR] = [MRR in USD], "Yes", "No")

If referring to 2 controls on an open form that does not have the
focus...
=IIF(Forms!frmName![MMR] = Forms!frmName![MRR in USD], "Yes", "No")
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Hi Al,
The "first" is the table name, inside this table, i have several fields,
two of them are "MRR" & " MRR in USD"

when i run the query with the expression that i wrote :
IIf(first![MRR]=first![MRR In USD],"yes","no")

it pops up a msg stating (undefined function "if" in expression)

Appreciate if you can help me to solve the issue.

Thank you so much for your time.

Frank Lim

Al Campagna said:
Frank,
What is "first?" Is it the name of the open form where the two text
controls are located?

If you are on a form, and want to compare 2 text controls on that
form...
=IIF([MMR] = [MRR in USD], "Yes", "No")

If referring to 2 controls on an open form that does not have the
focus...
=IIF(Forms!frmName![MMR] = Forms!frmName![MRR in USD], "Yes", "No")
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

Frank Lim said:
Dear all

I wish to compare 2 field data, to verify if those data is equal.

The expression i wrote is : IIf(first!MRR=first![MRR In USD],"yes","no")

The comparison is between Field MRR with MRR in USD.

I hope this type of query is possible in Access.

Thank you so much for your assistance.

Frank Lim
 
On Thu, 2 Apr 2009 19:35:01 -0700, Frank Lim <Frank
Dear all

I wish to compare 2 field data, to verify if those data is equal.

The expression i wrote is : IIf(first!MRR=first![MRR In USD],"yes","no")

The comparison is between Field MRR with MRR in USD.

I hope this type of query is possible in Access.

Thank you so much for your assistance.

Frank Lim

You can simply create a calculated field in your query:

AreTheyEqual: [MRR] = [MRR in USD]

This will be -1 if they are equal, 0 otherwise; if you prefer to see the words
yes and no, set the Format of the field (or the form/report control bound to
the field) to Yes/No.

Unless there are fields of the same name in other tables you don't need the
table name; if there are, use . rather than ! as the delimiter.

The fact that your error message refers to "if" suggests that you may have
misspelled it - it is in fact IIF() as you posted here. Are you sure it's not
IF() in the query?
 
Dear John & Al,

Thank you so much for your kind assistance.

John, its works now.

thanks again.

Frank Lim

John W. Vinson said:
On Thu, 2 Apr 2009 19:35:01 -0700, Frank Lim <Frank
Dear all

I wish to compare 2 field data, to verify if those data is equal.

The expression i wrote is : IIf(first!MRR=first![MRR In USD],"yes","no")

The comparison is between Field MRR with MRR in USD.

I hope this type of query is possible in Access.

Thank you so much for your assistance.

Frank Lim

You can simply create a calculated field in your query:

AreTheyEqual: [MRR] = [MRR in USD]

This will be -1 if they are equal, 0 otherwise; if you prefer to see the words
yes and no, set the Format of the field (or the form/report control bound to
the field) to Yes/No.

Unless there are fields of the same name in other tables you don't need the
table name; if there are, use . rather than ! as the delimiter.

The fact that your error message refers to "if" suggests that you may have
misspelled it - it is in fact IIF() as you posted here. Are you sure it's not
IF() in the query?
 

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

Back
Top