423,850 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,850 IT Pros & Developers. It's quick & easy.

Runtime error 3061

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.