By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

Problems creating "if then" in an Access Query

P: 1
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
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
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.