Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access and ASP Problem: Parameter query

Status
Not open for further replies.

IonelBurtan

Programmer
May 25, 2001
601
RO
I have a .mdb which has a query that requires one In Parameter. I want to be able to call the query which returs a table from ASP.

let's assume the query is called TheQuery and the parameter is called TheParameter and is an integer

I have tried:
Select * from TheQuery
where (TheParameter = 1)

But I get the message: Too few parameters. Expected 1.

Tnx,

s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Parameter variables cannot be called directly from with ACCESS SQL queries. You must call up a Function that in turn retrieves the parameter variable value:

Code:
Global TheParameter as Integer
Public Function TheParam() as Integer
TheParam = TheParameter
End Function

The Global variable is declared and the Public Function is created above.

Now in your query the following:

Code:
Select * from TheQuery
where ([red]TheParam()[/red] = 1)

Hope this helps

[COLOR=006633]Bob Scriver[/color]
MIState1.gif
[COLOR=white 006633]MSU Spartan[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top