473,320 Members | 1,957 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,320 software developers and data experts.

Runtime error 3061

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 not knowledgable enough in the
back-end of databases to figure it out, and my tech resource locally
hasn't responded to a call for help. Can anyone out there offer any
advice?! Thanks so much in advance.

Following is the line of code that the debugger highlights:

Set rst = db.OpenRecordset("qryChildrenCounts", dbOpenDynaset) ' Create
dynaset.
rst.MoveFirst
Here is all of the code that the debugger shows me:
Private Sub Detail1_Print(Cancel As Integer, PrintCount As Integer)
Dim rst As Recordset
Dim db As Database
Dim intLocation As Integer
Dim intFamilyLocation As Integer
Dim varSex As Variant
Dim intUnder3StuartF As Integer
Dim intUnder3StuartM As Integer
Dim int35StuartF As Integer
Dim int35StuartM As Integer
Dim int68StuartF As Integer
Dim int68StuartM As Integer
Dim int912StuartF As Integer
Dim int912StuartM As Integer
Dim int13StuartF As Integer
Dim int13StuartM As Integer

Dim intUnder3NoneF As Integer
Dim intUnder3NoneM As Integer
Dim int35NoneF As Integer
Dim int35NoneM As Integer
Dim int68NoneF As Integer
Dim int68NoneM As Integer
Dim int912NoneF As Integer
Dim int912NoneM As Integer
Dim int13NoneF As Integer
Dim int13NoneM As Integer

Dim intUnder3IndiantownF As Integer
Dim intUnder3IndiantownM As Integer
Dim int35IndiantownF As Integer
Dim int35IndiantownM As Integer
Dim int68IndiantownF As Integer
Dim int68IndiantownM As Integer
Dim int912IndiantownF As Integer
Dim int912IndiantownM As Integer
Dim int13IndiantownF As Integer
Dim int13IndiantownM As Integer

intUnder3NoneF = 0
intUnder3NoneM = 0
int35NoneF = 0
int35NoneM = 0
int68NoneF = 0
int68NoneM = 0
int912NoneF = 0
int912NoneM = 0
int13NoneF = 0
int13NoneM = 0

intUnder3StuartF = 0
intUnder3StuartM = 0
int35StuartF = 0
int35StuartM = 0
int68StuartF = 0
int68StuartM = 0
int912StuartF = 0
int912StuartM = 0
int13StuartF = 0
int13StuartM = 0

intUnder3IndiantownF = 0
intUnder3IndiantownM = 0
int35IndiantownF = 0
int35IndiantownM = 0
int68IndiantownF = 0
int68IndiantownM = 0
int912IndiantownF = 0
int912IndiantownM = 0
int13IndiantownF = 0
int13IndiantownM = 0

Set db = CurrentDb()
Set rst = db.OpenRecordset("qryChildrenCounts", dbOpenDynaset) '
Create dynaset.
rst.MoveFirst
Do While Not rst.EOF
intLocation = NullToZero(rst!fldDispositon)
intFamilyLocation = NullToZero(rst!fldFamilyLocation)
varSex = rst!fldSex
'Debug.Print intLocation; varSex
Select Case varSex
Case "F"
Select Case intLocation ' Agency Recommendation
Case 0
Select Case intFamilyLocation 'Family Location
Case 2
intUnder3IndiantownF =
intUnder3IndiantownF + rst![Under 3]
int35IndiantownF = int35IndiantownF +
rst![3-5]
int68IndiantownF = int68IndiantownF +
rst![6-8]
int912IndiantownF = int912IndiantownF +
rst![9-12]
int13IndiantownF = int13IndiantownF +
rst![13+]
Case Else
intUnder3StuartF = intUnder3StuartF +
rst![Under 3]
int35StuartF = int35StuartF + rst![3-5]
int68StuartF = int68StuartF + rst![6-8]
int912StuartF = int912StuartF +
rst![9-12]
int13StuartF = int13StuartF + rst![13+]
End Select
'intUnder3NoneF = intUnder3NoneF + rst![Under
3]
'int35NoneF = int35NoneF + rst![3-5]
'int68NoneF = int68NoneF + rst![6-8]
'int912NoneF = int912NoneF + rst![9-12]
'int13NoneF = int13NoneF + rst![13+]
Case 1, 3
intUnder3StuartF = intUnder3StuartF +
rst![Under 3]
int35StuartF = int35StuartF + rst![3-5]
int68StuartF = int68StuartF + rst![6-8]
int912StuartF = int912StuartF + rst![9-12]
int13StuartF = int13StuartF + rst![13+]

Case 2
intUnder3IndiantownF = intUnder3IndiantownF +
rst![Under 3]
int35IndiantownF = int35IndiantownF + rst![3-5]
int68IndiantownF = int68IndiantownF + rst![6-8]
int912IndiantownF = int912IndiantownF +
rst![9-12]
int13IndiantownF = int13IndiantownF + rst![13+]
End Select
Case "M"
Select Case intLocation
Case 0
Select Case intFamilyLocation
Case 2
intUnder3IndiantownM =
intUnder3IndiantownM + rst![Under 3]
int35IndiantownM = int35IndiantownM +
rst![3-5]
int68IndiantownM = int68IndiantownM +
rst![6-8]
int912IndiantownM = int912IndiantownM +
rst![9-12]
int13IndiantownM = int13IndiantownM +
rst![13+]
Case Else
intUnder3StuartM = intUnder3StuartM +
rst![Under 3]
int35StuartM = int35StuartM + rst![3-5]
int68StuartM = int68StuartM + rst![6-8]
int912StuartM = int912StuartM +
rst![9-12]
int13StuartM = int13StuartM + rst![13+]
End Select

'intUnder3NoneM = intUnder3NoneM + rst![Under
3]
'int35NoneM = int35NoneM + rst![3-5]
'int68NoneM = int68NoneM + rst![6-8]
'int912NoneM = int912NoneM + rst![9-12]
'int13NoneM = int13NoneM + rst![13+]

Case 1, 3
intUnder3StuartM = intUnder3StuartM +
rst![Under 3]
int35StuartM = int35StuartM + rst![3-5]
int68StuartM = int68StuartM + rst![6-8]
int912StuartM = int912StuartM + rst![9-12]
int13StuartM = int13StuartM + rst![13+]
Case 2
intUnder3IndiantownM = intUnder3IndiantownM +
rst![Under 3]
int35IndiantownM = int35IndiantownM + rst![3-5]
int68IndiantownM = int68IndiantownM + rst![6-8]
int912IndiantownM = int912IndiantownM +
rst![9-12]
int13IndiantownM = int13IndiantownM + rst![13+]
End Select
End Select
rst.MoveNext
Loop
rst.Close
'Me!txtUnder3NoneM = intUnder3NoneM
'Me!txtUnder3NoneF = intUnder3NoneF
'Me!txt35NoneM = int35NoneM
'Me!txt35NoneF = int35NoneF
'Me!txt68NoneF = int68NoneF
'Me!txt68NoneM = int68NoneM
'Me!txt912NoneF = int912NoneF
'Me!txt912NoneM = int912NoneM
'Me!txt13NoneF = int13NoneF
'Me!txt13NoneM = int13NoneM

Me!txtUnder3StuartM = intUnder3StuartM
Me!txtUnder3StuartF = intUnder3StuartF
Me!txt35StuartM = int35StuartM
Me!txt35StuartF = int35StuartF
Me!txt68StuartF = int68StuartF
Me!txt68StuartM = int68StuartM
Me!txt912StuartF = int912StuartF
Me!txt912StuartM = int912StuartM
Me!txt13StuartF = int13StuartF
Me!txt13StuartM = int13StuartM

Me!txtUnder3IndiantownM = intUnder3IndiantownM
Me!txtUnder3IndiantownF = intUnder3IndiantownF
Me!txt35IndiantownM = int35IndiantownM
Me!txt35IndiantownF = int35IndiantownF
Me!txt68IndiantownF = int68IndiantownF
Me!txt68IndiantownM = int68IndiantownM
Me!txt912IndiantownF = int912IndiantownF
Me!txt912IndiantownM = int912IndiantownM
Me!txt13IndiantownF = int13IndiantownF
Me!txt13IndiantownM = int13IndiantownM

End Sub

Nov 13 '05 #1
2 5915
fa********@yahoo.com wrote:
Dim db As Database


Try changing this to

Dim db As DAO.Database

and make sure you have the latest DAO library reference selected in the
module preferences.

There are other things to be aware of and action when converting A97 to
A2k3 - look here <http://members.iinet.net.au/~allenbrowne/ser-
48.html#conversion>

Regards,
Keith.
www.keithwilby.com
Nov 13 '05 #2
I'm guessing that qryChildrenCounts contains a reference such as:
[Forms].[Form1].[Text1]

That won't work for an OpenRecordset, because the Expression Service is not
available to resolve the reference in this context. You can set the
Parameter of the QueryDef in code, but it's generally easier to just use a
SQL statement as a string in VBA, concatenating the value from the text box
into the string.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<fa********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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 not knowledgable enough in the
back-end of databases to figure it out, and my tech resource locally
hasn't responded to a call for help. Can anyone out there offer any
advice?! Thanks so much in advance.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

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,...
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...
1
atksamy
by: atksamy | last post by:
i have the following code On Error GoTo TableTest_Error Set rs3 = CurrentDb.OpenRecordset(strsql3) GoTo continue ...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.