Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 378
  • Last Modified:

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
0
shieldsco
Asked:
shieldsco
  • 2
1 Solution
 
als315Commented:
Test this sample
Food-Voucher-V1-1-1.accdb
0
 
shieldscoAuthor Commented:
Thank you very much -- good job
0
 
als315Commented:
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

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now