Results 1 to 4 of 4
  1. #1
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501

    Add multiple individual items to inventory with single click

    I am creating a parts database and each part will be assigned to a car and customer so I want to add each inventory part as a single item. So I may have 20 widgets i need to add an all are the same but I want them to go in as 20 widgets with a unique id.



    I want to be able to add the basic data like name of product, description and unit price. Then i want to be able to have a box that i can put a number in and then append that number of records to the table.

    I can easily create the table and fields, i am just not sure how to use the number in the box to create that many records. I am thinking maybe some kind of vba loop where it runs the loop to add records a many times as the number in the the box.

  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,652
    You can use a For/Next loop that uses the form field as the loop quantity. Within that, use the AddNew method of a recordset or execute append SQL using your values.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tagteam is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    501
    Yes, my problem is that I am not good with Vba

    Here is my attempt

    sub loop_to_add_parts

    Dim NumberOfParts As Integer

    For AddParts as Double = 1 to NumberOfParts
    =====run append query here
    Next NumberOfParts

    I know that is pretty weak, but so are my vba skills

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, you'd need to set NumberOfParts, like:

    NumberOfParts = Me.TextboxWithQuantity

    You should declare the other variable. Within the loop, either use the AddNew method of a recordset or create and execute an SQL string.
    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. Replies: 4
    Last Post: 09-18-2021, 05:13 AM
  2. Replies: 1
    Last Post: 10-08-2017, 09:59 AM
  3. Replies: 1
    Last Post: 06-01-2016, 10:14 AM
  4. Get data from Multiple Items Form Row on click
    By takara in forum Programming
    Replies: 3
    Last Post: 06-03-2015, 06:55 PM
  5. Replies: 1
    Last Post: 09-11-2014, 05:53 AM

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