INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

iif statement issue

iif statement issue

(OP)
I have an access database back end and I'm trying to use this iif statement iif(schedule.type like '%p%', staff.rate1, staff.rate2). But I keep getting the error that the like statement is not recognized.

RE: iif statement issue

Hi,

Please post your code.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
That's all I have it's new table adapter I created with two tables from access one table is called sched which has a column named Type the other is called staff which has a column called rate1 and rate2 the table is joined by employee column.

RE: iif statement issue


Quote:

iif(schedule.type like

Quote:

one table is called sched

Do ya see a problem here?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
Oh...Ok sorry the table is called sched not schedule I missed typed it in my post.

RE: iif statement issue


so now your iif() statement works, yes?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
No still get the same error

RE: iif statement issue

post your code please, as it currently runs.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
SELECT DISTINCT Staff.Employee, Staff.Rate1, Staff.Rate2, Sched.Type,iif([sched].[type] like 'P', staff.rate2, iif([sched].[type] not like 'P', staff.rate1)) as exp2

FROM (Sched RIGHT OUTER JOIN
Staff ON Sched.Employee = Staff.Employee)
GROUP BY Staff.Employee, Staff.Rate1, Staff.Rate2, Sched.Type

RE: iif statement issue

Why not sched.type?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
not sure what you mean?

RE: iif statement issue


CODE

SELECT DISTINCT
  Staff.Employee
, Staff.Rate1
. Staff.Rate2
, Sched.Type
, iif(sched.type like '%P%', staff.rate2, staff.rate1) as exp2

FROM (Sched RIGHT OUTER JOIN
Staff ON Sched.Employee = Staff.Employee) 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
i just tried the code in query builder and the do results show but it still says error in list function arguments: 'LIKE' not recognized. Unable to parse query text

RE: iif statement issue

Try * rather than %

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: iif statement issue

(OP)
nope still not working. im using query builder. i don't know if that matters?

RE: iif statement issue

I would try:

CODE --> sql

SELECT DISTINCT
  Staff.Employee
, Staff.Rate1
, Staff.Rate2
, Sched.Type
, iif(sched.type like "*P*", staff.rate2, staff.rate1) as exp2

FROM (Sched RIGHT OUTER JOIN
Staff ON Sched.Employee = Staff.Employee) 


Are you running this totally in an Access application or is there a different "front-end"?

If this doesn't work, please be more descriptive with what results you are getting.

Duane
Hook'D on Access
MS Access MVP

RE: iif statement issue

(OP)
I found the issue in access I had a query with two tables that were not joined. Is there way to fix that. The two tables don't have any columns that I can join

RE: iif statement issue

How would you logically join these two?

Would a cartisian join be appropriate?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close