Results 1 to 4 of 4
  1. #1
    MCCDOM is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    28

    Entering one item to create multiple entries

    Hi all,



    I am a little bit stumped on how to do this so would really appreciate some help.

    Basically I am inputting stock into my database so I can have a record of what I have left and who it's gone too. Where I'm stuck though is when I want to add an item that I have more than one off but only enter it once and have it assigned a unique stock ID number (this is in the form of an autonumber) for however much quantity I choose to enter. So for example I have 5 keyboards, I type in 'Keyboard' into my item field (named txtItem) and then type '5' into my quantity field (named txtQuantity). When I then press Add Stock (named btnAddStock) I should then see in the table, 5 separate Keyboards listed each with a different Stock ID number.

    Hopefully I've explained this enough but any questions please don't hesitate to ask.

    Look forward to your replies

    Thanks

    Dom

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    In a form, enter the item, and Qty, say:
    txtItem
    txtQty

    Build an append query that adds the 1 item, then the button click will run a loop

    Code:
    sub button_click()
    dim i as integer
    
    docmd.setwarnings false
    
    for i = 1 to txtqty
       docmd.openquery "qaAddItem"
    next
    
    docmd.setwarnings true
    end sub

  3. #3
    MCCDOM is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    28
    Thank you for your quick reply.

    I will try and put this into practice and get back to you with the result.

    Thanks again

  4. #4
    MCCDOM is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    28
    Hi Ranman256,

    I tried what you've suggested and created a 'Append Query' for the add item, not sure if I did it right though (see attached photo of the query) as it does create multiple copies in the stock table but unfortunately it is just making copies of what was already in the table (see attached stock table photo). Could you let me know what might of gone wrong or i'm not doing correctly.

    Many thanks

    Click image for larger version. 

Name:	tblStock.JPG 
Views:	5 
Size:	50.0 KB 
ID:	18579Click image for larger version. 

Name:	qryAddStock.JPG 
Views:	5 
Size:	29.5 KB 
ID:	18580Click image for larger version. 

Name:	frmAddStock.JPG 
Views:	5 
Size:	17.9 KB 
ID:	18581Click image for larger version. 

Name:	btnAddStock.JPG 
Views:	5 
Size:	19.6 KB 
ID:	18582

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

Similar Threads

  1. Replies: 1
    Last Post: 07-07-2013, 10:29 PM
  2. Replies: 1
    Last Post: 05-20-2013, 01:45 PM
  3. need to create sub-forms with multiple entries
    By asinha9 in forum Database Design
    Replies: 2
    Last Post: 03-20-2013, 07:04 PM
  4. Create multiple entries with same data
    By swavemeisterg in forum Forms
    Replies: 6
    Last Post: 05-30-2012, 10:16 AM
  5. Entering more than one item when prompted?
    By 10 Gauge in forum Reports
    Replies: 10
    Last Post: 03-23-2011, 08:47 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