PC Review


Reply
Thread Tools Rate Thread

Adding Parameters To Queries

 
 
Goofy
Guest
Posts: n/a
 
      10th Oct 2006
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 ?


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      10th Oct 2006
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

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Goofy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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 ?



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameters in queries colmkav Microsoft Access Form Coding 13 21st Jan 2008 03:03 PM
Parameters in queries =?Utf-8?B?U2FyYWggYXQgRGFWaXRh?= Microsoft Access Queries 2 18th Apr 2007 01:02 AM
Re: Queries and Parameters Zachary Turner Microsoft Access 1 15th Sep 2004 10:27 PM
Queries and Parameters Zachary Turner Microsoft Access 1 15th Sep 2004 03:39 AM
Using Queries with Parameters =?Utf-8?B?Q29s?= Microsoft Access Forms 1 21st May 2004 02:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:11 AM.