I have a sub beginning with the following code:
Public Sub PreviousCat()
On Error GoTo EditCatError
Dim I As Integer
Dim MyDB As Database, MyRs As Recordset, FilteredSet As Recordset, CatQuery As String
10 Set MyDB = DBEngine.Workspaces(0).OpenDatabase("C:\Program Files\Microsoft Visual Basic\Ballots\BALLOTS.mdb"
20 Set MyRs = MyDB.OpenRecordset("Names", dbOpenDynaset)
30 If MyRs.RecordCount > 0 Then
40 MyRs.MoveFirst
45 txtCatID.Text = MyRs![CatID] 'ID number of first category.
55 VarBallotPage = MyRs![BallotPage] 'Page number of first category
60 CatQuery = "SELECT * FROM Names WHERE BallotNumber = VarBallotNumber AND BallotPage = VarBallotPage AND CatID = VarCategoryID"
'Create a Dynaset based on the parameter query
70 Set FilteredSet = MyDB.OpenRecordset(CatQuery, dbOpenDynaset)
When I try to run it, I'm getting Error #3061. Too few parameters. Expected 3. on line #70.
Can anybody tell me why and what I can do about it? Thanks.
Weltman
Public Sub PreviousCat()
On Error GoTo EditCatError
Dim I As Integer
Dim MyDB As Database, MyRs As Recordset, FilteredSet As Recordset, CatQuery As String
10 Set MyDB = DBEngine.Workspaces(0).OpenDatabase("C:\Program Files\Microsoft Visual Basic\Ballots\BALLOTS.mdb"
20 Set MyRs = MyDB.OpenRecordset("Names", dbOpenDynaset)
30 If MyRs.RecordCount > 0 Then
40 MyRs.MoveFirst
45 txtCatID.Text = MyRs![CatID] 'ID number of first category.
55 VarBallotPage = MyRs![BallotPage] 'Page number of first category
60 CatQuery = "SELECT * FROM Names WHERE BallotNumber = VarBallotNumber AND BallotPage = VarBallotPage AND CatID = VarCategoryID"
'Create a Dynaset based on the parameter query
70 Set FilteredSet = MyDB.OpenRecordset(CatQuery, dbOpenDynaset)
When I try to run it, I'm getting Error #3061. Too few parameters. Expected 3. on line #70.
Can anybody tell me why and what I can do about it? Thanks.
Weltman