ms access query

S

samm

I have table names "TableAreaCod" contain fields as:
CountryN: for country name
CityN: for city name
CountryC: for country code
CityC: for city code
Rate: for price each minute
Discount: for discount and time of discount.

I have query names "Query2" created by previous
table "TableAreaCod" , the criteria in the CityN
field
[Enter city name],
and I tried other critetia as [Forms]![Form3]![CityN] but
it gave same function.

And I have form names "Form3" , record
source "Query2"

My Question
When I open query or form always come box ask me to
enter the city name, it is ok query but I like without
coming box
I want make inquiry by writing city name in the text
box names "TCityN" in the form.
 
J

John Viescas

If you want to use a form parameter, the form must be open before Access
opens the query. Access actually runs the query before the form loads
fully, so it cannot resolve a parameter that references the form that uses
the parameter query as its record source. You need another form where the
user can enter the city name and then click a button to open your form based
on the parameter. The usual technique is to hide the parameter form by
setting its Visible property to False -- the form must remain open for the
parameter to work.

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
J

John Viescas

Thanks, Ken. I'll let you take it from here... <s>

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
Ken Snell said:
John -

I have been involved with an earlier thread with samm on this issue. It
appears that he's posted another thread on the same topic. Just to let you
know that we're both answering the same question. The issue is how he
references the form's control.

--
Ken Snell
<MS ACCESS MVP>


John Viescas said:
If you want to use a form parameter, the form must be open before Access
opens the query. Access actually runs the query before the form loads
fully, so it cannot resolve a parameter that references the form that uses
the parameter query as its record source. You need another form where the
user can enter the city name and then click a button to open your form based
on the parameter. The usual technique is to hide the parameter form by
setting its Visible property to False -- the form must remain open for the
parameter to work.

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
samm said:
I have table names "TableAreaCod" contain fields as:
CountryN: for country name
CityN: for city name
CountryC: for country code
CityC: for city code
Rate: for price each minute
Discount: for discount and time of discount.

I have query names "Query2" created by previous
table "TableAreaCod" , the criteria in the CityN
field
[Enter city name],
and I tried other critetia as [Forms]![Form3]![CityN] but
it gave same function.

And I have form names "Form3" , record
source "Query2"

My Question
When I open query or form always come box ask me to
enter the city name, it is ok query but I like without
coming box
I want make inquiry by writing city name in the text
box names "TCityN" in the form.
 

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