Results 1 to 2 of 2
  1. #1
    dwilson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Location
    Indianapolis
    Posts
    22

    MAcro to fill in voucher numbers

    We have a transportation database for clients who get our transporation vouchers. There are three basic tables, the client table, the order table, and the voucher table. When I client decides to order say 20 vouchers, the program will tell us the next available voucher number, but the user has to manually type in each line for the voucher number (because we have to print out each one separately, and keep track of each one when they are redeemed, etc. The user just asked if there is some way Access could just fill in these records in the voucher table.


    So, if John Doe wants 10 vouchers, and the system says the next available voucher # is 1001, then they would like records 1001, 1002, 1003, 1004, etc written to the voucher table. Is this possible using a macro of some kind?
    Attached Thumbnails Attached Thumbnails a1.JPG   a2.JPG  

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    See if this gives you any ideas:

    Code:
      For lngPassNum = lngStartNum To lngEndNum
    
      strSQL = "INSERT INTO tblTrolleyDayPass (TicketNum,DateStock,Status) " & _
               "VALUES (" & lngPassNum & ", #" & Me.txtDate & "#, 'S')"
    
      CurrentDb.Execute strSQL
      Next lngPassNum
    If I was doing it again now, I'd use a recordset, but for smaller quantities SQL would be fine.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. weighted numbers macro
    By TrackStar in forum Programming
    Replies: 12
    Last Post: 06-27-2012, 02:00 PM
  2. Replies: 1
    Last Post: 05-07-2012, 08:21 AM
  3. Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  4. Replies: 1
    Last Post: 11-29-2011, 08:43 AM
  5. Replies: 0
    Last Post: 01-12-2011, 12:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums