469,648 Members | 1,192 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

Problems creating "if then" in an Access Query

After all is done, I want query(s) which will give me the ability to create a report which will allow me to compare 3 apts with the parameters equaling bedroom size, and rents which are equal or greater to the tenant's current rent and bedroom size.


The first problem: Creating a field which will output a result which is contingent to what was inputed on the Bedroom Size. The apt.bedx is the cost of the rent.

(spelled out for one field)
Expr1
If the field tenant.Bedroom_size = "0" then output field apt.bed0
If the field tenant.Bedroom_size = "1" then output field apt.bed1
If the field tenant.Bedroom_size = "2" then output field apt.bed2
If the field tenant.Bedroom_size = "3" then output field apt.bed3
If the field tenant.Bedroom_size = "4" then output field apt.bed4

(spelled out for a different query)
The second problem: Creating a field which would compare the results from the previous expr and output the results.
Expr2
tenant.gross rent <= Expr1

[Email Removed]
Apr 27 '07 #1
1 1667
MMcCarthy
14,534 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. ColumnName:
  2. IIf([tenant].[Bedroom_size] = "0",[apt].[bed0],
  3. IIf([tenant].[Bedroom_size] = "1",[apt].[bed1],
  4. IIf([tenant].[Bedroom_size] = "2",[apt].[bed2],
  5. IIf([tenant].[Bedroom_size] = "3",[apt].[bed3],
  6. IIf([tenant].[Bedroom_size] = "4",[apt].[bed4],0)))))
(spelled out for a different query)
The second problem: Creating a field which would compare the results from the previous expr and output the results.
Expr2
tenant.gross rent <= Expr1
I don't understand the logic of what you are asking here.
Apr 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Chris Tilley - HPC:Factor | last post: by
40 posts views Thread by Steve Juranich | last post: by
145 posts views Thread by Sidney Cadot | last post: by
35 posts views Thread by David Cleaver | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.