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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too few parameters 1

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
I am running code:
__________________________________

strSQL1 = "SELECT DISTINCT ID FROM Scales"
Set rst1 = dbs.OpenRecordset(strSQL1, dbOpenForwardOnly)
Do While Not rst1.EOF
' Open records for this ID, sorted by Date.
strSQL2 = "SELECT * FROM Scales WHERE ID=" & rst1!ID & " ORDER BY Date"
Set rst2 = dbs.OpenRecordset(strSQL2, dbOpenDynaset)
__________________________________
and getting "Too few parameters. Expected 1" error.

My data example is:

ID_______Date______Action_____Scale
1_______1/1/2000___PRO_________111
1_______1/1/2001___PRO_________111
1_______1/1/2002___PRO_________111
1_______1/1/2003___PRO_________111
 
Seems like ID isn't defined as numeric in scales, so I'd try this:
Code:
strSQL2 = "SELECT * FROM Scales WHERE ID=[!]'[/!]" & rst1!ID & "[!]'[/!] ORDER BY [Date]"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks!!!!

One m ore question.

I had used code to step trough a recordset
rst2.FindFirst "Action='PRO'"

I do not have an Action field anymore and I need to use Max Date to start from.
How can I change
rst2.FindFirst "Action='PRO'"
to
rst2.FindFirst "Max([Date])"

Thanks so much
 
More info too my question.

Data looks like following

Details on what I want to accomplish:

ID______Date________Scale
11____1/1/2002_______112
11____1/1/2003_______112
11____1/1/2006_______111

Use to be

Details on what I want to accomplish:

ID______Date________Scale___Action
11____1/1/2002_______112_____NONE
11____1/1/2003_______112_____NONE
11____1/1/2006_______111_____PRO

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top