Results 1 to 4 of 4
  1. #1
    oldager is offline Novice
    Windows 10 Access 2003
    Join Date
    Aug 2020
    Location
    Ireland
    Posts
    7

    Combobox has list but selected item in list does not populate

    Hi,

    Access 2003

    I have finally got my list from a table [Agents] (with 3 columns AgentID, AgentName and Phone) to show in my combobox. However, if I click on any name [AgentName] in the list I get a Windows or MS Access error sound. The selected name in the list does not stay visible in the combox control but does stay in the combobox list.

    Control Source: =[Agent].[Column](2)
    Row Source Type: Table/Query


    Row Source: SELECT AgentID, [AgentName] FROM Agents;
    Bound Column: 2

    Any help much appreciated and thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    i dont think you can set to Agent.column(2)
    you can set text fields to columns in the AFTERUPDATE event when user picks from the combo:

    Code:
    sub cboBox_afterupdate()
    txtBox = cboBox.column(1)
    end sub


    then you can query off the text box.
    NOTE: in vb, columns begin with zero, so column 2 would be: column(1)

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,537
    Try:

    Control Source: NameOfBoundField

    Row Source Type: Table/Query
    Row Source: SELECT AgentID, [AgentName], [NameOfPhoneField] FROM Agents;
    Bound Column: 1

    Replace
    NameOfBoundField with the name of the field in the forms Record Source that the data will be saved in.

    Replace NameOfPhoneField with the name of the field in the "Agents" table.

    I have assumed that "AgentID" is an Auto-Number and is the Primary Key of the "Agents" table
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    oldager is offline Novice
    Windows 10 Access 2003
    Join Date
    Aug 2020
    Location
    Ireland
    Posts
    7
    Many thanks for your input, ranman256. However, Bob Fitz gave the answer that I needed. It is working as it should.

    Thanks again Bob Fitz; star clicked!

    Regards, oldager

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

Similar Threads

  1. Identify the first selected item from a list box
    By jcc285 in forum Programming
    Replies: 5
    Last Post: 04-29-2020, 12:18 PM
  2. Combobox 'Item Not In List' problem
    By DubCap01 in forum Forms
    Replies: 1
    Last Post: 02-01-2017, 02:28 AM
  3. Change Font Color of Selected List Box Item
    By buckwheat in forum Access
    Replies: 2
    Last Post: 06-03-2013, 03:46 PM
  4. Replies: 4
    Last Post: 07-27-2011, 09:52 AM
  5. Replies: 1
    Last Post: 11-23-2010, 01:30 PM

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