How Do I Append Records In Sequence Using An Access Append Query

Posted on 2011-10-05
Last Modified: 2013-11-10
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
Question by:shieldsco
    LVL 39

    Accepted Solution

    Test this sample

    Author Closing Comment

    Thank you very much -- good job
    LVL 39

    Expert Comment

    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!VoucherNo = i
        rst!FullName = Me.FullName
    Next i
    Set rst = Nothing

    Open in new window


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now