Criteria issue

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

Guest

First off thanks for the inputs and the knowledge that will be gain today.
I'm running a query to filter out data that will be used to make calls. The
orginial table TblContact contains:
-name
-address
-city
-state
-county
-phone

My dream is to enter a city and the db will return not only that city but
all the other city in tnat particular county. Will I need to have a separate
table of just the cities and counties to achieve my dream. Or can I do this
in one table with an expression?
 
You can do that easily with your existing table.
Try:
SELECT City from tblContact WHERE County IN (SELECT County from tblContact
WHERE City = [Form]![Whatever]![City])

There might be other more elegant ways to do it.

- Dorian
 
So sorry but how would I apply this into an expression or spell it out.
--
When you put water in a cup, the water becomes the cup.
When you put water in a tea pot, the water becomes the tea pot.
Be like water and adapter to every and any situation.


mscertified said:
You can do that easily with your existing table.
Try:
SELECT City from tblContact WHERE County IN (SELECT County from tblContact
WHERE City = [Form]![Whatever]![City])

There might be other more elegant ways to do it.

- Dorian

AbstractGofer said:
First off thanks for the inputs and the knowledge that will be gain today.
I'm running a query to filter out data that will be used to make calls. The
orginial table TblContact contains:
-name
-address
-city
-state
-county
-phone

My dream is to enter a city and the db will return not only that city but
all the other city in tnat particular county. Will I need to have a separate
table of just the cities and counties to achieve my dream. Or can I do this
in one table with an expression?
 
So...

The Validation rule would be in this format; (SELECT County from tblContact
WHERE City = [Form]![Whatever]![City]).
and
The Validation text would be the sentence before it?

Doesn't allow me to save the changes due to Object be invalid or no longer
set.

Some one come to this underdog's rescue.

--
When you put water in a cup, the water becomes the cup.
When you put water in a tea pot, the water becomes the tea pot.
Be like water and adapter to every and any situation.


mscertified said:
You can do that easily with your existing table.
Try:
SELECT City from tblContact WHERE County IN (SELECT County from tblContact
WHERE City = [Form]![Whatever]![City])

There might be other more elegant ways to do it.

- Dorian

AbstractGofer said:
First off thanks for the inputs and the knowledge that will be gain today.
I'm running a query to filter out data that will be used to make calls. The
orginial table TblContact contains:
-name
-address
-city
-state
-county
-phone

My dream is to enter a city and the db will return not only that city but
all the other city in tnat particular county. Will I need to have a separate
table of just the cities and counties to achieve my dream. Or can I do this
in one table with an expression?
 
Your original post never mentioned an 'expression' or a 'validation rule',
you asked for a Query and that's what I gave you. You save it as a query. You
can use the query in the recordsource of a combo box or list box or in a
report.
- Dorian

AbstractGofer said:
So...

The Validation rule would be in this format; (SELECT County from tblContact
WHERE City = [Form]![Whatever]![City]).
and
The Validation text would be the sentence before it?

Doesn't allow me to save the changes due to Object be invalid or no longer
set.

Some one come to this underdog's rescue.

--
When you put water in a cup, the water becomes the cup.
When you put water in a tea pot, the water becomes the tea pot.
Be like water and adapter to every and any situation.


mscertified said:
You can do that easily with your existing table.
Try:
SELECT City from tblContact WHERE County IN (SELECT County from tblContact
WHERE City = [Form]![Whatever]![City])

There might be other more elegant ways to do it.

- Dorian

AbstractGofer said:
First off thanks for the inputs and the knowledge that will be gain today.
I'm running a query to filter out data that will be used to make calls. The
orginial table TblContact contains:
-name
-address
-city
-state
-county
-phone

My dream is to enter a city and the db will return not only that city but
all the other city in tnat particular county. Will I need to have a separate
table of just the cities and counties to achieve my dream. Or can I do this
in one table with an expression?
 

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