Question : multi findfirst criteria string

Can anyboby tell me what is being wrong with my multiple criteria string used in the coding, because I can't work out why my string always returned me "syntax error (missing operator) in expression".


correct and verified seting up recordset & dim variables .........

With rstCharge
    'set PPD - OC criteria
      Dim Payment As String
      Dim Paycode As String
      Payment = "P"
      Paycode = "OC"
      strCriteria = "[HAWB/AWB]='" & SelectedHawb & "'" & _
      "[PaymentMethod]='" & Payment & "'" & _
      "[ServiceCode]='" & Paycode & "'"
     
      If .NoMatch Then
        Exit Function
       Else
        .FindFirst strCriteria
        Forms![frm Ops Details].[P_OC] = ![ServiceCharge]
    End If
End With
rstCharge.close

Answer : multi findfirst criteria string

First you should have spaces  between selectedHawb and [paymentmethod] in addition to several other places.

Second, you must have and betweein the different criteria.

Your function evaluates to this:
[HAWB/AWB]=' aaaa'[PaymentMethod]='P'[ServiceCode]='OC'
And should look like this

[HAWB/AWB]=' aaaa' and [PaymentMethod]='P' and [ServiceCode]='OC'

Third:
I think you should apply the criteria before you check for .nomatch...
'
Regards, Arve
Random Solutions  
 
programming4us programming4us