Too few paranetiers

  • Thread starter Thread starter Synergy Tooling Systems
  • Start date Start date
S

Synergy Tooling Systems

I'm stumped. This following method is giving me an error:

Run time error '3061'
Too few parameters. Expected 1.

CurrentDb.Execute "INSERT INTO FindOrderRowSourceTemp ( ordID, ordJob, ordCustName, ordProdLocation, Days ) " & _
"SELECT [Order Entry Header].ordID, [Order Entry Header].ordJob, [Order Entry Header].ordCustName, [Order Entry Header].ordProdLocation, DateDiff('d',[ordDate],Date()) AS Days " & _
"FROM [Order Entry Header] " & _
"WHERE ((DateDiff('d',[ordDate],Date())<=" & i & ") AND [Order Entry Header].ordProdLocation = [Location Filter]) " & _
"ORDER BY [Order Entry Header].ordJob DESC;"


I put this into the QBE grid make adjustments for the variable i and removing the the quotes and ampersands and it was fine.

I have another similar method in the same procedure, without the "AND [Order Entry Header].ordProdLocation = [Location Filter]) " clause which works fine.


So the Where clause is the problem, but I can't see what it.

Thanks for any help.

Synergy
 
What is LocationFilter? Is that a parameter that you'd enter when you run
the query from the grid? When you do it in code, you must provide the
parameter to the string, as VBA will not do it for you.
--

Ken Snell
<MS ACCESS MVP>



I'm stumped. This following method is giving me an error:

Run time error '3061'
Too few parameters. Expected 1.

CurrentDb.Execute "INSERT INTO FindOrderRowSourceTemp ( ordID, ordJob,
ordCustName, ordProdLocation, Days ) " & _
"SELECT [Order Entry Header].ordID, [Order Entry
Header].ordJob, [Order Entry Header].ordCustName, [Order Entry
Header].ordProdLocation, DateDiff('d',[ordDate],Date()) AS Days " & _
"FROM [Order Entry Header] " & _
"WHERE ((DateDiff('d',[ordDate],Date())<=" & i & ") AND
[Order Entry Header].ordProdLocation = [Location Filter]) " & _
"ORDER BY [Order Entry Header].ordJob DESC;"


I put this into the QBE grid make adjustments for the variable i and
removing the the quotes and ampersands and it was fine.

I have another similar method in the same procedure, without the "AND [Order
Entry Header].ordProdLocation = [Location Filter]) " clause which works
fine.


So the Where clause is the problem, but I can't see what it.

Thanks for any help.

Synergy
 
Ken,

Location filter is a ComboBox on the form. I tried:

"WHERE ((DateDiff('d',[ordDate],Date())<=" & i & ") AND [Order Entry
Header].ordProdLocation = " & [Location Filter] & ") " & _

Which didn't help. The original syntax should be ok, becuase this method I
am replacing works fine:

[FindOrder].RowSource = "SELECT [Order Entry Header].ordID, [Order Entry
Header].ordJob, [Order Entry Header].ordCustName, [Order Entry
Header].ordProdLocation, DateDiff('d',[ordDate],Date()) AS Days FROM [Order
Entry Header]WHERE (((DateDiff('d',[ordDate],Date()))<=" & i & ") AND
(([Order Entry Header].ordProdLocation)=[Location Filter])) ORDER BY [Order
Entry Header].ordJob DESC;"

Notice the where clause. I think I must have a syntax error, but can't
recognize it.
 
Back
Top