By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

runtime error 3061 - too few parmeters, expected 1

P: 16
ACCESS 2003 VBA in the code below set.rs3, gets the error when I try using a parm for input to the where clause. If I use a number like the one comented out it works.

Thanks for your help.

Private Sub subBuildcredits()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Dim rs3 As DAO.Recordset
Dim rs4 As DAO.Recordset
Dim intClock As Integer

Dim Sql4 As String
Sql4 = "DELETE tblPerfectAttend4.* FROM tblPerfectAttend4;" ' Clear credit data filedata file
DoCmd.RunSQL Sql4 ' clear tblPerfectAttend4 before

Set db = CurrentDb
Set rs1 = db.OpenRecordset("SELECT * FROM tblPerfectAttend1")
Set rs2 = db.OpenRecordset("SELECT * FROM tblPerfectAttend2 where tblPerfectAttend2!perfect = true")
Set rs4 = db.OpenRecordset("SELECT * from tblPerfectAttend4")

rs2.MoveFirst

intClock = rs2!clock ' control for employee ID
strEmpName = rs2!Name
While Not rs2.EOF
strClock = rs2!clock ' control for employee ID
Set rs3 = db.OpenRecordset("SELECT * FROM tblPerfectAttend3 WHERE tblPerfectAttend3.MstClock=intClock")
' Set rs3 = db.OpenRecordset("SELECT * FROM tblPerfectAttend3 WHERE tblPerfectAttend3.MstClock=63")
rs3.MoveFirst
While Not rs3.EOF
rs3.MoveNext
Wend
rs3.Close
rs2.MoveNext
Wend
rs1.Close
rs2.Close
rs4.Close
End Sub
Nov 21 '06 #1
Share this Question
Share on Google+
4 Replies


P: 16
I got it, but thanks for looking.

JH001A
Nov 21 '06 #2

NeoPa
Expert Mod 15k+
P: 31,186
lol - Good for you.
The answer was that you had your variable name in the SQL string instead of the value from the variable.
It's always better if you find it yourself though :)
Nov 21 '06 #3

P: 3
I got it, but thanks for looking.

JH001A

Do you mind sharing your solution? I'm having the same problem but can't figure it out.

Thanks.
Apr 12 '07 #4

P: 16
Do you mind sharing your solution? I'm having the same problem but can't figure it out.

Sorry it took so long to reply. Hope this helps.....

Thanks.
Private Sub subBuildcredits()
Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Dim rs3 As DAO.Recordset
Dim rs4 As DAO.Recordset
Dim intClock As Integer

Dim Sql4 As String
Sql4 = "DELETE tblPerfectAttend4.* FROM tblPerfectAttend4;" ' Clear credit data filedata file
DoCmd.RunSQL Sql4 ' clear tblPerfectAttend4 before

Set db = CurrentDb
Set rs1 = db.OpenRecordset("SELECT * FROM tblPerfectAttend1")
Set rs2 = db.OpenRecordset("SELECT * FROM tblPerfectAttend2 where tblPerfectAttend2!perfect = true")
Set rs4 = db.OpenRecordset("SELECT * from tblPerfectAttend4")

rs2.MoveFirst

intClock = rs2!clock ' control for employee ID
strEmpName = rs2!Name
While Not rs2.EOF
strClock = rs2!clock ' control for employee ID
Set rs3 = db.OpenRecordset("SELECT * FROM tblPerfectAttend3 WHERE tblPerfectAttend3.MstClock=" & intClock)
' Set rs3 = db.OpenRecordset("SELECT * FROM tblPerfectAttend3 WHERE tblPerfectAttend3.MstClock=63")
rs3.MoveFirst
While Not rs3.EOF
rs3.MoveNext
Wend
rs3.Close
rs2.MoveNext
Wend
rs1.Close
rs2.Close
rs4.Close
End Sub
Apr 27 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.