Too few paranetiers

  • Thread starter Synergy Tooling Systems
  • 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
 
K

Ken Snell [MVP]

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
 
S

Synergy Tooling Systems

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.
 
S

Synergy Tooling Systems

Ken,

Ignore my last message. I left out the quotes. It worked, Thanks.
 

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

Top