Too Few Parameters

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I have a recordset, rsDOS, that basically comprises four sales divisions.
The second recordset is part of a looping command below. The looping command
is having trouble with [DivisionID] = " & rsDOS![DivisionID] & ". In both
recordsets, DivisionID is actually a text value ID (unfortunately, my company
uses text for these IDs). For some reason I don't understand, it's saying I
have too few paramenters. Any guidance would be great. Thanks!

Set db = CurrentDb
Set rsDOS = db.OpenRecordset("SELECT * FROM SalesDivision")
If Not rsDOS.EOF Then
Do While Not rsDOS.EOF

Set rsCore = db.OpenRecordset("SELECT * " & _
"FROM [PerformanceDivision] " & _
"WHERE ProductC1ID = 1 AND [DivisionID] = " & rsDOS![DivisionID] & " AND
YearID = " & DatePart("yyyy", Forms!Dashboard!Yesterday) & " AND MonthID = "
& DatePart("m", Forms!Dashboard!Yesterday))
 
text values you have to pass in quotes:
const cQuote = """"
....AND [DivisionID] = " & cQuote & rsDOS![DivisionID] & cQuote & ...
 
Alex,

You're a life saver! THANK YOU!!

Alex Dybenko said:
text values you have to pass in quotes:
const cQuote = """"
....AND [DivisionID] = " & cQuote & rsDOS![DivisionID] & cQuote & ...

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com



Mike C said:
Hi. I have a recordset, rsDOS, that basically comprises four sales
divisions.
The second recordset is part of a looping command below. The looping
command
is having trouble with [DivisionID] = " & rsDOS![DivisionID] & ". In both
recordsets, DivisionID is actually a text value ID (unfortunately, my
company
uses text for these IDs). For some reason I don't understand, it's saying
I
have too few paramenters. Any guidance would be great. Thanks!

Set db = CurrentDb
Set rsDOS = db.OpenRecordset("SELECT * FROM SalesDivision")
If Not rsDOS.EOF Then
Do While Not rsDOS.EOF

Set rsCore = db.OpenRecordset("SELECT * " & _
"FROM [PerformanceDivision] " & _
"WHERE ProductC1ID = 1 AND [DivisionID] = " & rsDOS![DivisionID] & " AND
YearID = " & DatePart("yyyy", Forms!Dashboard!Yesterday) & " AND MonthID =
"
& DatePart("m", Forms!Dashboard!Yesterday))
 
Back
Top