shieldsco
asked on
How Do I Append Records In Sequence Using An Access Append Query
I want to use an append query to append records to a table (tblFood - See attached). Also, I want to automatically update the VoucherNo field in sequence. For example I wanted to enter an ending voucher number and the query will append records beginning with the next number in the sequence and ending with the number entered by the user. In addition I want to enter a name in the FullName field that will be appended along with the voucher number
Food-Voucher-V1-1-1.accdb
Food-Voucher-V1-1-1.accdb
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Not very good:
I forget to close recordset in the end of sub.
I forget to close recordset in the end of sub.
Dim rst As Recordset
Dim i As Long
Set rst = CurrentDb.OpenRecordset("tblFoodVoucher")
For i = CLng(Me.Text14) To CLng(Me.VoucherNo)
rst.AddNew
rst!VoucherNo = i
rst!FullName = Me.FullName
rst.Update
Next i
rst.Close
Set rst = Nothing
Me.Refresh
ASKER