Results 1 to 4 of 4
  1. #1
    craigalaniz is offline Novice
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    2

    Columns in a Listbox

    Hi All

    I am trying to get the selected data from a listbox to insert into a table. I am only able to get the first column into the table. I am not sure how to select columns 2 and 3.

    Dim sql As String

    sql = "INSERT INTO [CHS negotiator] ([Staff ID#], [Staff Last Name], [Staff First Name]) VALUES ('" & List4 & "', '" & List4 & "', '" & List4 & "');"



    CurrentDb.Execute sql



    Thanks

    Craig

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    from a listbox?

    so where is the data to begin?; in order for it to be in a listbox it must already be in a table - - unless you've manually typed it into the listbox properties....

  3. #3
    craigalaniz is offline Novice
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    2

    Smile

    Thanks for your reply. The listbox is getting data from a SQL Server table. (List of all employees). I need for the user to be able to add one of these employees to a table that is in Access when needed.

    Thanks

    Craig

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The ListBox control has a Column() property that is 0 based so Me.ListBoxName.Column(2) is the 3rd column.

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

Similar Threads

  1. Replies: 3
    Last Post: 08-25-2010, 09:03 AM
  2. Cancel listbox selection
    By vba-dev in forum Access
    Replies: 0
    Last Post: 10-26-2009, 12:18 PM
  3. Replies: 3
    Last Post: 08-11-2009, 02:21 PM
  4. Replies: 1
    Last Post: 04-09-2009, 09:18 AM
  5. adding list to a listbox
    By jetrow in forum Access
    Replies: 0
    Last Post: 08-15-2006, 03:36 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