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

Pass Parameter Value from Form to Query

P: n/a
rg
Hi all,

I have query about passing a parameter from form to a query. My situation
is as follows:

I have a query that pulls up some data from a table, however there is a
condition that must be filled in by the user. Hence when you run the query
there is a "Enter Parameter Value" prompt that must be completed. A further
complication is that the parameter is actually within the WHERE statement,
i.e.:

SELECT * FROM TABLE1 WHERE TABLE1.FIELD1 = VAR1;

I am trying to use that query from inside a form that I have created.
Currently, when I open the form I get the "Enter Parameter Value" but what I
would I like is for the form to set the parameter value automatically (the
value of which is dependent on certain conditions). Is it possible to use a
macro or some kind of expression that automatically sets the value when I
open/modify the form so that I don't get the prompt.

BTW, I am using MS Access 2003 on Windows XP Pro.

Any help would be greatly appreciated.

Many Thanks for any help in advance,

RG
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
SELECT * FROM TABLE1 WHERE TABLE1.FIELD1 = Forms!Formname!Controlname;

--

Ken Snell
<MS ACCESS MVP>

"rg" <rg****@hotmail.com> wrote in message
news:d1**********@news.freedom2surf.net...
Hi all,

I have query about passing a parameter from form to a query. My situation
is as follows:

I have a query that pulls up some data from a table, however there is a
condition that must be filled in by the user. Hence when you run the query
there is a "Enter Parameter Value" prompt that must be completed. A
further
complication is that the parameter is actually within the WHERE statement,
i.e.:

SELECT * FROM TABLE1 WHERE TABLE1.FIELD1 = VAR1;

I am trying to use that query from inside a form that I have created.
Currently, when I open the form I get the "Enter Parameter Value" but what
I
would I like is for the form to set the parameter value automatically (the
value of which is dependent on certain conditions). Is it possible to use
a
macro or some kind of expression that automatically sets the value when I
open/modify the form so that I don't get the prompt.

BTW, I am using MS Access 2003 on Windows XP Pro.

Any help would be greatly appreciated.

Many Thanks for any help in advance,

RG

Nov 13 '05 #2

P: n/a
rg
Hi,

Sorry for the delay in replying. Just wanted to say thanks, your feedback
really helped me.

RG
"Ken Snell [MVP]" <kt***********@ncoomcastt.renaetl> wrote in message
news:Oe*************@TK2MSFTNGP14.phx.gbl...
SELECT * FROM TABLE1 WHERE TABLE1.FIELD1 = Forms!Formname!Controlname;

--

Ken Snell
<MS ACCESS MVP>

"rg" <rg****@hotmail.com> wrote in message
news:d1**********@news.freedom2surf.net...
Hi all,

I have query about passing a parameter from form to a query. My situation is as follows:

I have a query that pulls up some data from a table, however there is a
condition that must be filled in by the user. Hence when you run the query there is a "Enter Parameter Value" prompt that must be completed. A
further
complication is that the parameter is actually within the WHERE statement, i.e.:

SELECT * FROM TABLE1 WHERE TABLE1.FIELD1 = VAR1;

I am trying to use that query from inside a form that I have created.
Currently, when I open the form I get the "Enter Parameter Value" but what I
would I like is for the form to set the parameter value automatically (the value of which is dependent on certain conditions). Is it possible to use a
macro or some kind of expression that automatically sets the value when I open/modify the form so that I don't get the prompt.

BTW, I am using MS Access 2003 on Windows XP Pro.

Any help would be greatly appreciated.

Many Thanks for any help in advance,

RG


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.