Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    dccjr3927 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    130

    Thank you for all of the help. I finally found the issue, resolved it, and deployed. While frustrating at time, I expanded my knowledge, so it was a win-win. Thanks again.

  2. #17
    dccjr3927 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    130
    So after testing other items, I noticed that my iteration through the listbox is executing the correct number of times, but it is inserting the same values (row 0) of strSKU, intQty, strProcess for each iteration. Did I forget or omit something for these variables to update each time?

    Code:
    For i = 0 To Me.lstMultiItem.ListCount - 1
               varItem = Me.lstMultiItem.ItemData(i) 'get next item in list data
               Me.lstMultiItem = varItem     'set listbox to the item
               strSKU = Me.lstMultiItem.Column(0)
               intQty = Me.lstMultiItem.Column(1)
               strProcess = Me.lstMultiItem.Column(2)
               strRecordWOSQL = "INSERT INTO WOTracking (Process, ContractCo, Employee, SKU, SKUQty, OrderNo, Date_Time) VALUES ('" _
                     & strProcess & "','" & Me.cbxContractCo.Value & "','" & Me.cbxEmployee.Value & "','" & strSKU & "'," & intQty & ",'" & Me.tbxOrderNo.Value & "',#" & dtDateTime & "#)"
               CurrentDb.Execute strRecordWOSQL
               strUpdateQtySQL = "UPDATE Inventory SET Inventory.SaleableQty = Inventory.SaleableQty -" & intQty & " WHERE SKU  = '" & strSKU & "';"
               DoCmd.RunSQL strUpdateQtySQL
    Next i
    It seems to me like it should use the values from each row, but maybe I have forgotten something.

  3. #18
    dccjr3927 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    130
    Got it.

    strSKU = Me.lstMultiItem.Column(0)

    should be:

    strSKU = Me.lstMultiItem.Column(0,1)

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problems with subreports and IIF statments
    By ByronC in forum Reports
    Replies: 4
    Last Post: 12-15-2016, 02:42 PM
  2. randomizing statments on report
    By BatmanMR287 in forum Reports
    Replies: 2
    Last Post: 07-12-2015, 01:34 PM
  3. If statments??!!
    By wmagargle in forum Programming
    Replies: 4
    Last Post: 08-30-2012, 02:45 PM
  4. How to iterate through a custom collection
    By vicrauch in forum Programming
    Replies: 6
    Last Post: 07-21-2011, 02:51 PM
  5. INSERT INTO with listbox
    By TheShabz in forum Programming
    Replies: 6
    Last Post: 11-30-2010, 12:19 PM

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
  •  
Other Forums: Microsoft Office Forums