Link to home
Start Free TrialLog in
Avatar of T B
T BFlag for Saudi Arabia

asked on

MS Access docom.openform multiple criteria

Hi,

I've passed two criteria to open form and it was successful. However when I tried to pass 3 criteria it does not go thru. Hence Could you please help what is wrong with below mentioned code and what is the correct , kindly note the following :-
Project_Short_Name = Text
Exp_Ac_Type = Text
ExpenseDateYYYY = Date and Formated as yyyy

DoCmd.OpenForm "frmEXP_00_0000_ALL_Cross_4_By_MaintenanceType", , , _
    "[Project_Short_Name] = ' " & Me!Project_Short_Name & " ' AND " & _
    "[Exp_Ac_Type] = ' " & Me!Exp_Ac_Type & " ' AND " & _
    "[ExpenseDateYYYY] = " & Me!ExpenseDateYYYY

Open in new window


Thanks.
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try this

DoCmd.OpenForm "frmEXP_00_0000_ALL_Cross_4_By_MaintenanceType", , , _
    "[Project_Short_Name] = '" & Me!Project_Short_Name & "' AND " & _
    "[Exp_Ac_Type] = '" & Me!Exp_Ac_Type & "' AND " & _
    "[ExpenseDateYYYY] ='" & Me!ExpenseDateYYYY & "'"

Open in new window


by the way, what is the code that worked with two criteria
Avatar of T B

ASKER

Dear Ray,

Super 100% up and running.

Could you please help how to add fourth criteria and it would be text.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial