473,756 Members | 6,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

runtime error 3061 - too few parmeters, expected 1

16 New Member
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 tblPerfectAtten d4.* FROM tblPerfectAtten d4;" ' Clear credit data filedata file
DoCmd.RunSQL Sql4 ' clear tblPerfectAtten d4 before

Set db = CurrentDb
Set rs1 = db.OpenRecordse t("SELECT * FROM tblPerfectAtten d1")
Set rs2 = db.OpenRecordse t("SELECT * FROM tblPerfectAtten d2 where tblPerfectAtten d2!perfect = true")
Set rs4 = db.OpenRecordse t("SELECT * from tblPerfectAtten d4")

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.OpenRecordse t("SELECT * FROM tblPerfectAtten d3 WHERE tblPerfectAtten d3.MstClock=int Clock")
' Set rs3 = db.OpenRecordse t("SELECT * FROM tblPerfectAtten d3 WHERE tblPerfectAtten d3.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 3723
JH001A
16 New Member
I got it, but thanks for looking.

JH001A
Nov 21 '06 #2
NeoPa
32,572 Recognized Expert Moderator MVP
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
monbois
3 New Member
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 New Member
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 tblPerfectAtten d4.* FROM tblPerfectAtten d4;" ' Clear credit data filedata file
DoCmd.RunSQL Sql4 ' clear tblPerfectAtten d4 before

Set db = CurrentDb
Set rs1 = db.OpenRecordse t("SELECT * FROM tblPerfectAtten d1")
Set rs2 = db.OpenRecordse t("SELECT * FROM tblPerfectAtten d2 where tblPerfectAtten d2!perfect = true")
Set rs4 = db.OpenRecordse t("SELECT * from tblPerfectAtten d4")

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.OpenRecordse t("SELECT * FROM tblPerfectAtten d3 WHERE tblPerfectAtten d3.MstClock=" & intClock)
' Set rs3 = db.OpenRecordse t("SELECT * FROM tblPerfectAtten d3 WHERE tblPerfectAtten d3.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
3313
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 encountering the "run-time error 3061" issue, but I'm not sure how to go about correcting the SQL. My hunch is that I have not properly constructed things to identify a date field, but I don't know how to correct this issue. In addition to not...
3
4018
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 is posted below
2
5544
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, it reads: SELECT Edits.Pattern, Edits.From, Edits.To FROM Edits WHERE (((Edits.Language)=!.)); The idea is to select just the language-appropriate records from the
2
5938
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 in case that has anything to do with the problem. There are pre-set reports that can be run with this database. I am getting a Runtime Error 3061 with one of them. It says Too Few Parameters. Expected 1. I have tried to trouble-shoot, but am...
4
7163
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". But I keep getting this error: Runtime Error 3061: Too Few Parameters expected 1. What should I be looking for to fix this? Here's my code so far: Private Sub cmdAddIngredientToRecipe_Click() Dim dbGetRecipeID As DAO.Database
1
22305
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, I've stripped away everything that doesn't cause the error to make my question a little simpler. Here's the problem in its simplest form inside a report: Dim db As DAO.Database
3
2549
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 get " & strFileName & " data" Err.Clear GoTo NextFile 'most likely, the spreadsheet lacks the lowUtilizationANDMemory field
3
4385
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
2991
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. Now the query and database are already open so I'm not entirely sure of any connection strings I may need. I think part of the problem may be that the parameter I am using to call the function is part of the query. I am not sure how to come by this...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.