Results 1 to 8 of 8
  1. #1
    swaggers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5

    Add 1 to X records in one table from info entered into table 2


    I have a entry table that someone enters [Supplier], [Grade], [#]

    I need to take that one like and create records in another table that copies the Supplier & Grade, BUT adds a new record for 1 of X all the way to X. So if on the entry table someone puts 3 in #. The second tables needs to have a record for 1,2, & 3.

    Possible? Any help? Been searching for a week for a solution.

  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,640
    You can adapt this:

    http://www.baldyweb.com/MultiselectAppend.htm

    using a For/Next loop that uses the quantity instead of a listbox.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    swaggers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    Thanks for the push in the right direction.

    I've created a form with two Lists List0 and List2 and 2 text entry points.

    When I run my event though I get: "Item not found in this collection"

    Here is my script sections:
    Set db = CurrentDb()
    Set rs = db.OpenRecordset("SkinInventory", dbOpenDynaset, dbAppendOnly)

    And then:
    rs.AddNew
    rs!Supplier = Me.list0
    rs!Grade = Me.list2
    rs!ToteTot = Me.NumTotes
    rs!RecvBatch = Me.BatchNum
    rs!LabelToPrint = Yes
    rs.Update

  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,640
    The error would imply that the field doesn't exist in that table. Double check your field names (it should be telling you what line).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    swaggers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    Thanks. I swear I triple checked them and there was a spelling error. Now to work on the loop part...

  6. #6
    swaggers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    Almost have this.

    Dim numTTotal As Integer



    For numTTotal = 1 To Me.NumTotes
    rs.AddNew
    rs!Supplier = Me.List0
    rs!Grade = Me.List2
    rs!ToteTot = Me.NumTotes
    rs!Tote# = numTTotal
    rs!RcvBatch = Me.BatchNum
    rs!LabelToPrint = "1"
    rs.Update
    Next numTTotal

    I want to add the current loop number numTTotal to a field on the table also. But this is coming up "Item not found in this collection" also. I know for a fact that is the table field lol. Am I not referencing it right?

  7. #7
    swaggers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Posts
    5
    Got it. It doesn't like the # in the field name. So changed that and it works!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Happy to help. You could have bracketed the name:

    rs![Tote#]

    but you're better off changing the name anyway.
    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: 0
    Last Post: 03-12-2013, 02:51 PM
  2. Replies: 3
    Last Post: 10-25-2012, 09:37 PM
  3. Replies: 2
    Last Post: 08-15-2012, 02:21 AM
  4. Replies: 1
    Last Post: 07-26-2012, 10:51 AM
  5. Replies: 3
    Last Post: 01-31-2011, 11: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