Link to home
Start Free TrialLog in
Avatar of shieldsco
shieldscoFlag for United States of America

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
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shieldsco

ASKER

Thank you very much -- good job
Not very good:
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

Open in new window