Question : Use multi parameters in query criteria

Hi All
I have developed a query that uses a criteria function to select (filter) records based on a record's Institution Name, Contact Type (Contact Types may include "Director", "Doctor", "Minister" etc ) and Country . I have allowed the user to select all Contact Types or to select multiple Contact Types by using a multi lookup field.
After the user has made his/her selections I then store the selections in global string or integer variables (gsMultiContacts for Contact Types where gs = global string). If the user has selected the All Contact Types option I store "*" in the gsMultiContacts variable. If the multi Contact Type option is selected  then the user can make 1 to n selections. For example if the user has selected two Contact Types - say Director and Doctor -   I attempt to build a string to look like -  Director Or Doctor  - and save it in the gsMultiContacts variable - refer code below - Call msfPutMultiContacts(sMultiContact) -.
My query then uses a function in the criteria under the Contact Type column to get the gsMultiContact variable in order to filter the underlying record set.
The All option ("*") and a single multi selection (eg "Doctor") works as expected but when the user selects more than one Contact Type then the query doesn't return any records. If I enter -  "Director" Or "Minister" - directly in the criteria rather than using the function to get the  gsMultiContact variable the query works as expected. Obviously I'm not building the OR string correctly but no matter what I try I can't get it to work . I've tried wrapping each selection in double quotes, single quotes etc but no luck. I need help as I'm just spinning my wheels and getting nowhere fast. Mank Thanks
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
iRecordCount = DCount("[ContactId]", "qry4120_sel_InstitutionQueryContactTypes")
   If iRecordCount = 0 Then
       Call msfPutContactTypeId("*")
       Call msfPutMultiContacts("*")
    Else
       Set db = DBEngine(0)(0)
       Set rsMultiContactTypes = db.OpenRecordset _   ("qry4120_sel_InstitutionQueryContactTypes", dbOpenDynaset)
   
       If Not rsMultiContactTypes.BOF And Not rsMultiContactTypes.EOF Then
          rsMultiContactTypes.MoveFirst
       End If
       
       Do Until (rsMultiContactTypes.EOF)
          BeginTrans
          If iFirstTimeFlag = 0 Then
             sMultiContact = rsMultiContactTypes!ContactDesc
             iFirstTimeFlag = 1
          Else
             sMultiContact = sMultiContact & " Or " & rsMultiContactTypes!ContactDesc 
             iFirstTimeFlag = iFirstTimeFlag + 1
          End If
          rsMultiContactTypes.MoveNext
       Loop
       Call msfPutMultiContacts(sMultiContact)
   End If

Answer : Use multi parameters in query criteria

Your string should look like this:

= 'Director' Or ='General Contact'

Random Solutions  
 
programming4us programming4us