Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2012
    Location
    Toronto Ontario
    Posts
    10

    Unhappy Unanswered: Combo Box used as a Record filter - Can't filter on duplicate records!

    Hello,

    I was wondering if anyone could help out.

    I have a Main form which includes elements from table1 in textfields on the Main form for example:

    ID
    Firstname
    Lastname
    Phone
    Address

    I also added a comboBox to the Main form to use as a filter.

    In the combo box the row source is a Query:
    SELECT table1.Firstname, table1.Firstname, table1.Lastname FROM table1 ORDER BY table1.Firstname;

    (notice table1.Firstname is repeated, the filtering stops working if i change it)

    The search filter works great until I have two records with the same firstnames. When I try to select a person who has a duplicate firstname in the system only data from one person shows. If I try selecting the next person with the same name, a refresh happens only to show the same record data.

    I cannot seem to see different data if the first names are duplicate.

    Here is the AfterUpdate on the ComboBox filter:

    Private Sub Combo21_AfterUpdate()
    'Moves to Customer Name text box and
    'finds the record of whatever name is selected in the combo box
    DoCmd.ShowAllRecords
    DoCmd.FindRecord Me!Combo21

    'Set value of combo box equal to an empty string
    Me!Combo21.Value = ""
    End Sub


    Here is the OnGotFocus:

    Private Sub Combo21_GotFocus()
    Me.Refresh
    End Sub






    The code I adopted was from: Use a Microsoft Access Combo Box to Search for a Record | Database Solutions for Microsoft Access | databasedev.co.uk

    Please help as I have tried all I can in my capability to sort this out.
    (may not be ideal for duplicate elements but my db will not have many)

    Thanks in advanced for any assistance!
    Last edited by Mike Toshiba; 03-25-12 at 23:43.

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Send a short example of your MDB, (Access 2000 or 2002-2003).

  3. #3
    Join Date
    Mar 2012
    Location
    Toronto Ontario
    Posts
    10

    File attached

    Quote Originally Posted by MStef-ZG View Post
    Send a short example of your MDB, (Access 2000 or 2002-2003).

    I have created a sample database attached. MS Access 2003 is what I use.

    Please try filtering using the Andy's with the form1.
    It only displays "Any Choo" regardless of which Andy I choose.
    Attached Files Attached Files

  4. #4
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    I can't read your attachment.

  5. #5
    Join Date
    Mar 2012
    Location
    Toronto Ontario
    Posts
    10

    Its compressed in a .zip format

    Quote Originally Posted by MStef-ZG View Post
    I can't read your attachment.
    Its compressed in a zip file. I can't seem to attach the .mdb file in the thread as it won't allow it.

  6. #6
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372
    Look at "DemoSearchNextA2000.mdb" (attachment, zip).
    Open form and try. Look at VBA. Adapt it as you need in
    your mdb.
    Attached Files Attached Files

  7. #7
    Join Date
    Mar 2012
    Location
    Toronto Ontario
    Posts
    10

    Talking Thank You

    This has seem to fixed the issue thank you!

    I see how you have utilized the ID field in order to recall the records instead.

Posting Permissions

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