Results 1 to 3 of 3
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Set Focus to Next ListBox Item

    If user selects a item, it then asked for the Qty after clicking the command button to add the item. This could get very confusing since you wont have a way to determine which item you are entering a Qty for! Here is my code for the process; How do I advance to the next selected item after entering a Qty for the previous selected item?

    Set ctl = Me.ListOne
    For Each varItem In ctl.ItemsSelected
    rs.AddNew
    rs![Category ID] = ctl.ItemData(varItem)
    rs![Product Name] = ctl.ItemData(varItem)
    rs!OtherValue = InputBox("Enter a Numeric Quantity") ' It asks you for a Qty, I assume this is where the code would go
    ' rs!OtherValue = Me.txtOtherValue ' How about if I move Next varItem up one before rs.Update ???
    rs.Update
    Next varItem
    Attached Thumbnails Attached Thumbnails Enter a Numeric Quantity.jpg  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Tell the user which product the quantity is for. Your code will not pull data from each column of the selected items. Review http://allenbrowne.com/ser-50.html
    Code:
    Dim varItem As Variant
    Dim ctl As Control
    Set ctl = Me.List0ne
    For Each varItem In ctl.ItemsSelected
       rs!.AddNew
       rs![Category ID] = ctl.Column(0, varItem)
       rs![Product Name] = ctl.Column(1, varItem)
       rs!OtherValue =  InputBox("Enter a Numeric Quantity for product " & ctl.Column(1, varItem))
    Next
    You don't show code to declare, set, open recordset - assume you do have that in procedure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Thanks so much. Maybe I can get there from here!

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

Similar Threads

  1. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  2. Parent Item / Child Item Not Saving Correctly Together
    By Evilferret in forum Programming
    Replies: 6
    Last Post: 08-24-2012, 02:30 PM
  3. Replies: 7
    Last Post: 06-05-2012, 03:22 PM
  4. pick listbox item to open specific record
    By accesshelpme in forum Access
    Replies: 1
    Last Post: 05-20-2012, 01:08 AM
  5. Replies: 7
    Last Post: 10-25-2011, 08:32 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