passing parameters from a from to a query

G

granola911

Hi,

I'm trying to pass params from my form to a query.

In the query I ref the form value in the criteria: [form]![id]

I've tested my query directly and it works perfectly, however when I call my
query from my form (open at time of call), I am still prompted to supply the
param.

I have tried encasing my form value in quotes, but of course then it is seen
as a string literal.

Is there a simple way to tell the query that [form]![ID] isn't a prompt?

(I have looked at a zillion posting here but haven't found one for this
answer)

Thank you!!!
 
M

Marshall Barton

granola911 said:
I'm trying to pass params from my form to a query.

In the query I ref the form value in the criteria: [form]![id]

I've tested my query directly and it works perfectly, however when I call my
query from my form (open at time of call), I am still prompted to supply the
param.

Is there a simple way to tell the query that [form]![ID] isn't a prompt?


In a query, [form]![id] is not a valid reference to
anything.

Inside the form itself, it refers to the Form property of
the default object, which is the form. If that seems
redundant, it's because it is (better to use Me instead of
Form).

To refer to a control on a form from **outside** the form
(e.g. a query or another form), use this kind of reference:
Forms![name of the form].[name of the control]
or
Forms![name of the form]![name of the control]
 

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