Link to home
Start Free TrialLog in
Avatar of Scamquist
ScamquistFlag for United States of America

asked on

Open Access 2010 drill through with multiple criteria

I am trying to build a drill through sales form.  
When I click on a cell, I want to open another form (frmSingleMonthSales) filtered by a month number (L1, L2M L3...) and customer number.

If I use the line below, the form opens with all sales from Mth L1
DoCmd.OpenForm FormName:="frmSingleMonthSales", WhereCondition:="Mth= 'L1'"

If I use the line below, the form opens with all orders for the proper customer
DoCmd.OpenForm FormName:="frmSingleMonthSales", WhereCondition:="ID_CUST_SOLDTO = '" & Me.txtIdCust & "'"

When I combine the lines as below, I get a Run-Time error 13 Type mismatch
DoCmd.OpenForm FormName:="frmSingleMonthSales", WhereCondition:="Mth= 'L1'" And "ID_CUST_SOLDTO = '" & Me.txtIdCust & "'"

If the each of the first two lines work, why won't the combined line work.

Any help will be appreciated
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
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
In addition to Ron's correction, if your Customer ID is  numeric, drop the single quotes that are delimiting txtIdCust  as text:

 WhereCondition:="Mth= 'L1' And ID_CUST_SOLDTO = " & Me.txtIdCust 

Open in new window

Avatar of Scamquist

ASKER

Thank you for the assist.