if statement in access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am currently writting a ledger for a business and on the tags that they
have in the store they have the cost in a a code (for example a=1, b=2 c=3)
and I am unsure of how to get this into access. Someone please help! TIA!
 
The best approach is to have a table that maps the codes to the costs, join
the two tables in a query and use the query where you would otherwise have
used the table.

Alternatively, you can use a nested IIf statement:

IIf(CodeField="a", 1, IIf(CodeField="b", 2, IIf(CodeField="c", 3, 0)))

or the Switch statement:

Nz(Switch(CodeField="a", 1, CodeField="b", 2, CodeField="c", 3), 0)
 

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