Adding Parameters To Queries

  • Thread starter Thread starter Goofy
  • Start date Start date
G

Goofy

I need to know if Access 2003 supports parameters as SQL does and if so, how
do I set them. I know I can use a where clause but can I substitue the right
hand side of the equation with a @Paramname ?
 
Goofy, any name that Access cannot resolve, it assumes to be a parameter.

So you can query:
SELECT * FROM Table1 WHERE Table1.Field1 = WhatValue;
and Access will ask you to supply WhatValue at runtime (assuming there is no
field by that name.)

Enclose in square brackets if the parameter name contains spaces or other
special characters:
SELECT * FROM Table1 WHERE Table1.Field1 = [What Value?];

The PARAMETERS clause is optional, but recommended for any fields that are
not of type Text. It helps ensure that JET interprets the data type
correctly. You are better not to explicitly declare parameters used against
Text field, as Access fails to handle nulls correctly for declared
parameters of type Text. More on this bug:
http://allenbrowne.com/bug-13.html
 

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

Similar Threads


Back
Top