Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2015
    Posts
    1

    Question Unanswered: Adding multiple records at one time

    Hello,

    I haven't been able to find the best way to search for this question, so I'm hoping I can explain it properly. My situation is I am making a form to document work orders. One work order can contain multiple unique serial numbers.

    The serial numbers are broken up into 3 parts; a 4 digit Model identifier, a single digit series indicator, and a 4 digit serial number.

    The basic function I am looking for is the user inputs the Work Order number, then inputs the Model, Series, and number of units. Once they hit submit, I need it to add x amount of records with only the serial number changing by +1 for each record. This means it needs to know the last serial number for that model and series, and start with the next one.

    I hope this makes sense. Thank you!

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    The user inputs or supplies the list.
    run an append query to all records at once.

    (if you have a form, then you can build a loop.)
    what is your form items?

  3. #3
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Code:
    dim vSer, vNum
    dim sSql as string
    
    docmd.setwarnings false
    
    for vSer = 0 to txtNumUnits
     vNum = txtSerial + vSer 
     sSql = "insert into table ([model,[Series]) values ('" & txtModel & "','" & vNum & "')"
      docmd.runsql ssql
    next
    
    docmd.setwarnings true

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •