Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3219472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:39:00+00:00 2026-05-17T15:39:00+00:00

I can store records in the DB by using combobox with the following code.

  • 0

I can store records in the DB by using combobox with the following code.
Here single part number is selected and partnumber related data is stored in the DB table.

But I want the code for Listbox…When I select multiple partnumbers ..how can I store in the DB table?

Case "Pn ADDED to Wrapper", _
            "Pn REMOVED from Wrapper"
            If Me!PartNumber <> "All" And Me!PartNumber <> "Select" Then ' a proper part number has been selected in combo box
                strNewSq5 = _
                    "INSERT INTO tblTmpEventLog (TrackingNumber,PartNumber,PartNumberChgLvl,EnteredBy,EventTypeSelected,EventDate)"
                strNewSq5 = strNewSq5 & " VALUES ('" & tempTrackingNumber & "','" & _
                    tempPartNumber & "','" & _
                    tempPartNumberChgLvl & "','" & _
                    tempEnteredBy & "','" & _
                    tempEventTypeSelected & "'," & _
                    "#" & Forms!frmEventLog_Input.EventDate & "#)"
                dbs.Execute strNewSq5, dbFailOnError

                TrnsfTmpEventToEventLog
                Else
                        displayMsgBox = MsgBox("A single part number must be specified. Please correct.", vbCritical, "System Error")
                Exit Sub
                End If
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:39:01+00:00Added an answer on May 17, 2026 at 3:39 pm

    You need to iterate over the selected items and store them one by one:

    MS Access 2007 – Cycling through values in a list box to grab id's for a SQL statement

    EDIT re comment

    You do not provide sufficient information for a detailed answer, but here are some notes that may help.

    For Each itm In Me.NameOfListBox.ItemsSelected
          If Instr("All,Select",Me.NameOfListBox.Column(0, itm) )=0 Then 
               '' a proper part number has been selected in list box
    
               '' Me.NameOfListBox.Column(0, itm) is the column (zero in this example
               '' and row (itm) of the selected item in the list box. If it is the 
               '' part number, then you might like to say:
    
               '' tempPartNumber = Me.NameOfListBox.Column(0, itm)
    
               strNewSq5 = "INSERT INTO tblTmpEventLog " & _ 
                        "(TrackingNumber,PartNumber,PartNumberChgLvl,EnteredBy," & _
                        "EventTypeSelected,EventDate)"
               strNewSq5 = strNewSq5 & " VALUES ('" & tempTrackingNumber & "','" & _
                        tempPartNumber & "','" & _
                        tempPartNumberChgLvl & "','" & _
                        tempEnteredBy & "','" & _
                        tempEventTypeSelected & "'," & _
                        "#" & Forms!frmEventLog_Input.EventDate & "#)"
              dbs.Execute strNewSq5, dbFailOnError
    
              TrnsfTmpEventToEventLog
        Else
             ''Do not insert
        End If
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As you know, in ASP.NET, you can store session data in one of following
Say you have a bunch of files. Say you can store meta data to
Can I store a database connection in the Session object?
How can I store a hash table with separate chaining in a file on
Any gotchas I should be aware of? Can I store it in a text
Can i run download applications from Apple Store on iPhone simulator?
Can someone suggest a good module in perl which can be used to store
I know you can access the Contact Store from the SDk, but is it
Can anybody help me out to know the possible reasons for which Apple store
I know in ASP.NET I can get an item from a DropDownList by using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.