Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Filter Large Combo not working

Discussion in 'Information Technology' started by Warlord, Jul 28, 2006.

  1. Warlord

    Warlord
    Expand Collapse
    Guest

    Hello There,
    I am new in MS Access, so apologies if this is a silly question.

    I am trying to develop a Complaints Log for my company.
    There about 80,000 corporate customers. I appreciate it is not fair to have
    too many records in a combo. So I am trying to provide a way to filter the
    records.
    My Tables are:
    COMPLAINT (Complaint#, Motive, Company*)
    COMPANY (Company#, Company Name)

    In the entry form, I included a "textbox" so the user can type any part of
    the Company's Name. My query has the Criteria 'like & "*"
    [forms].[formname].[textbox] & "*".
    First I left the Rowsource looking the table and the Controlsource looking
    the query
    In the textbox beforeUpdate I set the combo to requery. It filters the
    records OK. But the table doesn't get updated.
    I also tried the other way round. Both ways seems to display correctly, but
    my table COMPLAINT doesn't updated.
    I bound my my combo to the textbox and a message "Cannot edit record because
    field is bound to 'and gives the same statement I used in the ControlSource'.
    Could you help me?
    Many Thanks
    Fabio
     
  2. Loading...

    Similar Threads Forum Date
    General Filter Test Hard Talk May 20, 2008
    Sikh News Largest Sikh Temple In Lower North Island Opens Its Doors - Stuff.co.nz Breaking News Sep 25, 2016
    Canada First Turban Day observed in Toronto, draws large crowd Breaking News Apr 1, 2014
    Sikh Coalition America's Largest Police Force Trained by the Sikh Coalition Sikh Organisations Jan 13, 2014
    Nature More than three quarters of large carnivores now in decline Breaking News Jan 12, 2014

  3. Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    To do stuff like this, you really should learn to do it in code. Your
    combobox should have no SQL in it at all when the form opens. (I'm assuming
    this is an Add form. If you're in a view/update form you'd approach this
    slightly differently. Let's start with the straightforward case.)

    private sub txtCompanySearch_AfterUpdate

    me.cboCompany.rowsource = "Select CompanyID, CompanyName From Company
    Where Company Name like '*" & Me.txtCompanySearch & "*' Order by
    CompanyName"

    end sub

    (The statement above wrapped because we're not in a VB editor.)

    The thing to notice is the single quote before the first ampersand and after
    the second one. Having queries refer to fields by going through the forms
    collection is almost guaranteed to cause you some headaches that can be
    easily avoided with a few lines of VB here and there.

    HTH.
     

Share This Page