M
MikeJohnB
I have asked this question before but no response, guess I didn't explain
myself very well. I am trying to re-number a control on a form if a line item
is deleted from a quote programme. I have tried the following code and
several other variations on MoveFirst MoveNext manipulation of the recordset.
Can anyone see why this does not work?
Private Sub Line_Item_No__GotFocus()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim i As Integer
strSQL = "SELECT * From Tbl_Quotation ORDER BY Line_Item_No_"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)<<<<<Fails here
rst.MoveFirst
i = 1
Do
rst.Edit
rst![Line_Item_No_] = i
Debug.Print Me.Line_Item_No_
rst.Update
rst.MoveNext
Loop Until rst.EOF
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
The Error is
Runtime Error 3061
Too few Parameter Expected 1.
Table Tbl_Quotation
Field Line_Item_No_
SQL Showing Table Structure which works to isolate the Line Items for the
current Quotaion base on a control on the top level form
SELECT Tbl_Quotation.Quotation_Ref, Tbl_Quotation.[Line_Item_No:]
FROM Tbl_Quotation
WHERE (((Tbl_Quotation.Quotation_Ref)=[Forms]![Frm_Main_Data]![Quote_Ref]));
i hope someone can assist, really stuck on the syntax for this one and
getting no where fast.
Regards
--
myself very well. I am trying to re-number a control on a form if a line item
is deleted from a quote programme. I have tried the following code and
several other variations on MoveFirst MoveNext manipulation of the recordset.
Can anyone see why this does not work?
Private Sub Line_Item_No__GotFocus()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim i As Integer
strSQL = "SELECT * From Tbl_Quotation ORDER BY Line_Item_No_"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)<<<<<Fails here
rst.MoveFirst
i = 1
Do
rst.Edit
rst![Line_Item_No_] = i
Debug.Print Me.Line_Item_No_
rst.Update
rst.MoveNext
Loop Until rst.EOF
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub
The Error is
Runtime Error 3061
Too few Parameter Expected 1.
Table Tbl_Quotation
Field Line_Item_No_
SQL Showing Table Structure which works to isolate the Line Items for the
current Quotaion base on a control on the top level form
SELECT Tbl_Quotation.Quotation_Ref, Tbl_Quotation.[Line_Item_No:]
FROM Tbl_Quotation
WHERE (((Tbl_Quotation.Quotation_Ref)=[Forms]![Frm_Main_Data]![Quote_Ref]));
i hope someone can assist, really stuck on the syntax for this one and
getting no where fast.
Regards
--