SQL Syntax

hascons

Registered User.
Local time
Today, 15:11
Joined
Apr 20, 2009
Messages
58
Can any one tell me the proper syntax for the Statement below:


strSQL = "SELECT * FROM [Work Type SubCategory] WHERE [Work Type Category ID]= strCategoryID"


strSQL is Text
Work Type SubCategory is a Table
Work Type Category ID is field in above table
strCategory is Long ( this gets passed from another procedure)

When I try to run I get Error Message:

Too few parameters. Expected 1


Thanks
 
Can any one tell me the proper syntax for the Statement below:


strSQL = "SELECT * FROM [Work Type SubCategory] WHERE [Work Type Category ID]= strCategoryID"


strSQL is Text
Work Type SubCategory is a Table
Work Type Category ID is field in above table
strCategory is Long ( this gets passed from another procedure)

When I try to run I get Error Message:

Too few parameters. Expected 1


Thanks

Try this:
strSQL = "SELECT * FROM [Work Type SubCategory] WHERE [Work Type SubCategory].[Work Type Category ID]= " & strCategory


The [Work Type SubCategory]. identifies the table containing the column [Work Type Category ID]. Not required when only 1 table is involved.

& strCategory identifies the long that you said comes from another procedure. You have 2 spellings for this, which is why the too few parameters error occurred.
I think the correct spelling is strCategory based on your info. You want to use the Value of strCategory in the SQL so that is why the value is appended (&) to the SQL string.
 
Thanks jdraw this solved the problem
 

Users who are viewing this thread

Back
Top Bottom