Cannot get multi combo box search to work

sydawn

New member
Local time
Today, 11:49
Joined
Jun 14, 2015
Messages
7
Hello all,

It is my first post here. I used the Contacts demo on Access 2010, made all the elements Client from web based and then exported to a new database. It worked for the most part but now I am trying to put in a 4 box search and am getting stuck on which form to link it to and also where to put these boxes.

Can anyone help me ?
 
If you mean, there is 4 combo boxes and the user can pick 1,2 or all 4, or any combination of, then here is a fix:

In a continous form of your data, you have the 4 combos in the header.
User may pick any of them to filter...so you need some vb logic:

You cant use form boxes in a query if there's nothing in them..so..
Test all controls for a possible filter then build the where clause.
Code:
if not isnull(cboState) then   sWhere = sWhere & " and [state]='" & cboState & "'"
if not IsNull(txtName) then    sWhere = sWhere & " and [Name]='" & txtName & "'"
if not IsNull(chkContact) then sWhere = sWhere & " and [Contact]=" & chkContact.value

    'remove 1st And
sWhere= mid(sWhere,4)

  'just use the filter

me.filter = sWhere
me.filterOn = true

   'OR   
   'apply the sql to the form

sSql = "SELECT * FROM tblCompany WHERE " & sWhere
 

Users who are viewing this thread

Back
Top Bottom