using an IIF with a field value to update


J

Jon M.

Hello all, I am running, or at least trying to run an update query using an
iif statements. I have a field called LicType, which can either be "2 Year"
or "4 year". I have another field called CreditsNeeded which is a number
field. If LicType = 2 Year, I want CreditsNeeded to equal 24. If LicType =
4 Year, I want CreditsNeeded to equal 48. Here is what I tried but when I run
the query it updates my CreditsNeeded to 0.

IIf([LicenseType]="4 Year",[CreditsNeeded]=48,[CreditsNeeded]=24)

As always I appreciate any suggestions.
 
Ad

Advertisements

K

KARL DEWEY

If CreditsNeeded is a text field then use this --
IIf([LicenseType]="4 Year",[CreditsNeeded]="48",[CreditsNeeded]="24")
 
D

Duane Hookom

Your update SQL should look partially like:
SET CreditsNeeded = IIf([LicenseType]="4 Year",48,24)

I would question why you need to store a value that can be calculated.
 
Ad

Advertisements

J

Jon M.

Thank you so much!
--
Jon M.


Duane Hookom said:
Your update SQL should look partially like:
SET CreditsNeeded = IIf([LicenseType]="4 Year",48,24)

I would question why you need to store a value that can be calculated.

--
Duane Hookom
Microsoft Access MVP


Jon M. said:
Hello all, I am running, or at least trying to run an update query using an
iif statements. I have a field called LicType, which can either be "2 Year"
or "4 year". I have another field called CreditsNeeded which is a number
field. If LicType = 2 Year, I want CreditsNeeded to equal 24. If LicType =
4 Year, I want CreditsNeeded to equal 48. Here is what I tried but when I run
the query it updates my CreditsNeeded to 0.

IIf([LicenseType]="4 Year",[CreditsNeeded]=48,[CreditsNeeded]=24)

As always I appreciate any suggestions.
 

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