Betty B
Betty B

Reputation: 185

Microsoft Access If statement Query

I'm trying to figure out why my below query is not working.

I have created a calculated field and as part of an IIf() I am looking at doing a LEFT function.

I am hoping to return the First char of the Display Value of a column rather than the Hidden Primary Key.

Just wondering if someone can point me in the right direction?

enter image description here

Upvotes: 0

Views: 406

Answers (1)

ashareef
ashareef

Reputation: 1846

You can debug this yourself by doing a couple of things. You haven't really provided specific information to what the problem you're facing.

First I would rewrite the query as such to reduce the number of paranthesis and make the intention/logic much clearer, which will also make it easier to debug.

IIf([General Notes] In ("FFA", "Consignment", "CCO", "Hargreaves", "SCRAP"), [General Notes], Left([Supplier_ID],1))

Then start with the following step and identify which field is causing the problem by breaking the query into seperate fields

IIf([General Notes] In ("FFA", "Consignment", "CCO", "Hargreaves", "SCRAP"), [General Notes], "") 
Left([Supplier_ID],1)
etc

As for the display value of the column rather than the hidden primary key, [Supplier_ID] sounds awfully like a name that would be given to a key. Perhaps you mean to place something like [Supplier_Name] or [Supplier] etc.

Upvotes: 2

Related Questions