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

I have developed a web application and various clients can store records to that
As you can know, you can store data against a contact on Android phones.
I have a grid with store: cdStore defined. The grid's records are edited using
I'm using leveldb to store records (key-value), where the key is a 64-bit hash
I am using an awful propriety CMS system. Its events module can store events
I'm using redis to store hashes with ~100k records per hash. I want to
It is often said that using LDAP is a good way to store data
I am fetching a set of objects from a Core Data persistent store using
I can store Session State in InProc or State Server or Sql Server. If
how we can store the e mail id into a database? i mean which

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.