P
paul.schrum
Access 2007, developing an Access 2003 database.
In the code which follows, Visual Basic stops at the openRecordset
line with a messagebox stating
Run-time error 3061:
Too few parameters. Expected 2.
Well I gave it two. Can someone explain to me what is going on and
how I should correct my code?
Private Sub mendLocalOrder()
Dim nextToLastNumber
Dim rst As DAO.Recordset
Set rst = CurrentDb().OpenRecordset("SELECT taskID, localOrder " &
_
"FROM tbl_tasks " & _
"WHERE personIDassignedTo =
me.cmb_assignTaskTo_createTasks " & _
" AND urgencyID = me.cmb_urgency_createTasks " & _
"ORDER BY localOrder", dbOpenDynaset)
With rst
If .RecordCount > 1 Then
.MoveLast
.MovePrevious
nextToLastNumber = ![localOrder]
.MoveLast
![localOrder] = nextToLastNumber + 1
.Update
ElseIf .RecordCount = 1 Then
![localOrder] = 100 * Me.cmb_urgency_createTasks + 1
.Update
End If
.Close
End With
Set rst = Nothing
End Sub
In the code which follows, Visual Basic stops at the openRecordset
line with a messagebox stating
Run-time error 3061:
Too few parameters. Expected 2.
Well I gave it two. Can someone explain to me what is going on and
how I should correct my code?
Private Sub mendLocalOrder()
Dim nextToLastNumber
Dim rst As DAO.Recordset
Set rst = CurrentDb().OpenRecordset("SELECT taskID, localOrder " &
_
"FROM tbl_tasks " & _
"WHERE personIDassignedTo =
me.cmb_assignTaskTo_createTasks " & _
" AND urgencyID = me.cmb_urgency_createTasks " & _
"ORDER BY localOrder", dbOpenDynaset)
With rst
If .RecordCount > 1 Then
.MoveLast
.MovePrevious
nextToLastNumber = ![localOrder]
.MoveLast
![localOrder] = nextToLastNumber + 1
.Update
ElseIf .RecordCount = 1 Then
![localOrder] = 100 * Me.cmb_urgency_createTasks + 1
.Update
End If
.Close
End With
Set rst = Nothing
End Sub