MCTampa
Board Regular
- Joined
- Apr 14, 2016
- Messages
- 97
I have a form with an option group from which a user will select one of the following parameters:
Resort Code (a three letter code)
Area Code (a three digit code)
Resort Region (a text string)
They must select one and can only select one of the elements.
The selection choice is output to a text box.
The text box is reading a different part of the form and is correctly returning the selection.
For example, the selection could say "XYZ" (Resort Code), or 999 (Area Code) or "The North" (Resort Region).
At this point, everything is working well.
I have a query with three fields match the above. One field for Resort Code, one field for Area Code and one field for Resort Region.
Here is my problem:
Under Resort Code, my criteria formula is: IIf([Forms]![Existing Resort]![DestinationChoice]=[forms]![Existing Resort]![ResortCode],[forms]![Existing Resort]![ResortCode],Null)
Under Area Code, my criteria formula is: IIf(Val([forms]![Existing Resort]![DestinationChoice])=[forms]![Existing Resort]![AreaCode],[forms]![Existing Resort]![AreaCode],Null)
I haven't yet moved on to Region, but it would be the same thing.
I believe my problem is the null at the end of the formula.
What I want is a formula for Resort Code to say "If the value in my destination choice doesn't match the resort code on the form, then essentially ignore this value"
The same for Area Code.
This way, ultimately, either the criteria for Resort Code or the criteria for Area Code or the criteria for Region will dictate the query results.
I'm trying to keep it all in one query so the user only have to run one macro.
Resort Code (a three letter code)
Area Code (a three digit code)
Resort Region (a text string)
They must select one and can only select one of the elements.
The selection choice is output to a text box.
The text box is reading a different part of the form and is correctly returning the selection.
For example, the selection could say "XYZ" (Resort Code), or 999 (Area Code) or "The North" (Resort Region).
At this point, everything is working well.
I have a query with three fields match the above. One field for Resort Code, one field for Area Code and one field for Resort Region.
Here is my problem:
Under Resort Code, my criteria formula is: IIf([Forms]![Existing Resort]![DestinationChoice]=[forms]![Existing Resort]![ResortCode],[forms]![Existing Resort]![ResortCode],Null)
Under Area Code, my criteria formula is: IIf(Val([forms]![Existing Resort]![DestinationChoice])=[forms]![Existing Resort]![AreaCode],[forms]![Existing Resort]![AreaCode],Null)
I haven't yet moved on to Region, but it would be the same thing.
I believe my problem is the null at the end of the formula.
What I want is a formula for Resort Code to say "If the value in my destination choice doesn't match the resort code on the form, then essentially ignore this value"
The same for Area Code.
This way, ultimately, either the criteria for Resort Code or the criteria for Area Code or the criteria for Region will dictate the query results.
I'm trying to keep it all in one query so the user only have to run one macro.