473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

runtime error 3061 - too few parmeters, expected 1

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
4 3699
JH001A
16
I got it, but thanks for looking.

JH001A
Nov 21 '06 #2
NeoPa
32,556 Expert Mod 16PB
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
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
JH001A
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

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

Similar topics

0
by: Miranda Evans | last post by:
I noticed several postings about issues related to "run-time error 3061", and I observed that the solutions to these issues appear to involve correcting something within the SQL code. I'm...
3
by: colm | last post by:
i get the above runtime error on the following line of code when i try to update a reord in my form when it gets to the line Set rs = DBEngine(0)(0).OpenRecordset(strSql) the entire code...
2
by: Steve Richfield | last post by:
There have been LOTS of postings about error 3061, but mine seems to be an even simpler case than the others. I have a simple **FUNCTIONING** query called qryEdits. Copying the SQL from the query,...
2
by: fanfromfla | last post by:
I am using a database that has worked for many years for a holiday project for needy families. My organization recently upgraded its server and changed everyone to Windows XP. I just mention that...
4
by: Richard Hollenbeck | last post by:
I thought I was very specific in this SQL request. There is a form open with a selected record (and a corresponding "lngRecipeID" on that form. The table also has a field called "lngRecipeID". ...
1
by: Richard Hollenbeck | last post by:
I wonder what I'm missing? I really feel like a retard because I've been screwing with some code for a very long time. I just must be missing something very simple. In the following example,...
3
by: ragtopcaddy via AccessMonster.com | last post by:
I have an error handler: On Error GoTo Outtahere At the end of the routine, the OuttaHere section reads: OuttaHere: If Err.Number <0 Then If Err.Number = 3061 Then Debug.Print " Failed to...
3
by: phill86 | last post by:
Hi, I am trying to run the following query in a recordset and i get the following error message Runtime error 3061 - Too few parameters. Expected 1 i am using the following code
8
Cintury
by: Cintury | last post by:
The problem is I have a function that I've created and stored in a module. I call it as an expression (e.g. total: Function(parameter)). I'm receiving the error 3061: too few parameters, expected 1....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.