T
TESA0_4
Hi,
I have a parent form and subform. The parent form displays details for a
'process'. Each process has a unique ID called QRID. The subform displays the
'tasks' that make up the process. The user is required to list the 'tasks'
and give each task a number that indicates the sequence in which the tasks
are done.
I have created a Function (plagerised from another dicsusion thread) that
enables the user to re-sort and re-number the task records so that they are
displayed in sequence and so they can insert or delete tasks. The Function
allows the tasks to be number with an integer increment of 1 (or more to
allow for insertion of tasks).
However, using the following code I get an error "Too few parameters. Expect
1".
Variable Q was included to prove to myself that the Function is actually
reading the QRID from the txtQRID field on the Parent form. If I amend the
Function so that the WHERE clause reads, say, [QRID] = 6 the Function works
fine for the process where QRID = 6.
I hope someone can help with some simple advice.
Public Function Renumber() As Integer
Dim MyDb As DAO.Database, MyRec As DAO.Recordset
Dim I As Double
Dim Q As Long
I = 0
Q = Me.Parent.txtQRID.Value
Set MyDb = CurrentDb
Set MyRec = MyDb.OpenRecordset("select [StepNo] from
QryRiskAssessTasks where [QRID] = Me.Parent.txtQRID.Value")
While Not MyRec.EOF
MyRec.Edit
I = I + Me.IncValue.Value
MyRec!StepNo = I
MyRec.Update
MyRec.MoveNext
Wend
End Function
I have a parent form and subform. The parent form displays details for a
'process'. Each process has a unique ID called QRID. The subform displays the
'tasks' that make up the process. The user is required to list the 'tasks'
and give each task a number that indicates the sequence in which the tasks
are done.
I have created a Function (plagerised from another dicsusion thread) that
enables the user to re-sort and re-number the task records so that they are
displayed in sequence and so they can insert or delete tasks. The Function
allows the tasks to be number with an integer increment of 1 (or more to
allow for insertion of tasks).
However, using the following code I get an error "Too few parameters. Expect
1".
Variable Q was included to prove to myself that the Function is actually
reading the QRID from the txtQRID field on the Parent form. If I amend the
Function so that the WHERE clause reads, say, [QRID] = 6 the Function works
fine for the process where QRID = 6.
I hope someone can help with some simple advice.
Public Function Renumber() As Integer
Dim MyDb As DAO.Database, MyRec As DAO.Recordset
Dim I As Double
Dim Q As Long
I = 0
Q = Me.Parent.txtQRID.Value
Set MyDb = CurrentDb
Set MyRec = MyDb.OpenRecordset("select [StepNo] from
QryRiskAssessTasks where [QRID] = Me.Parent.txtQRID.Value")
While Not MyRec.EOF
MyRec.Edit
I = I + Me.IncValue.Value
MyRec!StepNo = I
MyRec.Update
MyRec.MoveNext
Wend
End Function