[Forms]![frmNameOfForm].[cboControlName]

T

Tom

In a login form with 2 cascading combos. Their selected values will be
used in a query to subselect matching records. I use the following strings
in my query criteria:
- [Forms]![frmLogin].[cboState]
- [Forms]![frmLogin].[cboCity]

This process works fine and I get the proper results.

However, I am now dealing w/ a unique scenario. Let's say the 2 selected
values for cboState and cboCity are identical (e.g. "New York" | "New
York").

In this case, I don't want to find the records where New York exists in
field "State" AND field "City". Instead, I want to use "New York" as the
query criteria for yet another field (let's call this field "Exception").

Is there a way to create a smart query or SQL code that does look at the
values in both combos? And again, if they are the same, use either
selected value (State or City) as the criteria for a 3rd field.

Any suggestion how this could be accomplished?

Tom
 
M

Michel Walsh

Hi,

I am not sure I fully understand.


Instead of

WHERE field1 = "New York" OR field2 = "New York"

someone can use

WHERE "New York" IN ( Field1, Field2 )



Generally, the IN-list is made of constants, but there is nothing wrong by
making it a list of fields... even if it denotes, generally, a problem of
design (normalization of the table, OR of fuzz the User interface)




Hoping it may help,
Vanderghast, Access MVP
 

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