Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2002

    Question Unanswered: Listbox not displaying the correct record


    I have an Access 2000 database with a main form that
    utilizes the tab control. On the main tab I have a
    listbox that displays new entries as they are posted.

    If the user selects an item from the list box the record
    contents are displayed in the form fields for

    My problem is that when the list automatically updates and
    a user selects the most recent addition to the list what
    is displayed in the form is the very first record in the
    table instead of the record that was selected in the
    listbox. The way to get around this is to have the user
    right click on the form and select Remove filter/sort and
    then reselect the item in the listbox. The correct record
    is then displayed.
    I have a feeling this can be corrected with 'Requery'
    or 'FilterOn' but I don't know where or how to apply the

    Any help is greatly appreciated.


  2. #2
    Join Date
    Sep 2002
    South Wales

    Question DB Copy

    Can you eMail or post .zip copy of .mdb pls?

    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    May 2003
    Provided Answers: 5
    set the recordset of the subform to equal that of the combobox bound column
    after update of the combobox event

    dim myid
    myid = me!combobox

    forms!myform!mysubform.form.recordsource = "select * from mytable where idnumber = " & myid (if the id is a number if not
    = " & "'" & myid & "'"

    the only problem is that when you first enter the form there may not be any data (combobox is null) to query against - so on the ONOPen of the form

    forms!myform!mysubform.form.recordsource = "select * from mytable"

    every instance from then on - the subform will requery to the bound column data of the combo box

    meaning the first column of the combo needs to be the key data of the subform you are "filtering" for
    Dale Houston, TX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts