Solved

Open Access 2010 drill through with multiple criteria

Posted on 2013-01-12
3
468 Views
Last Modified: 2013-01-12
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
0
Comment
Question by:Scamquist
3 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 38770503
WhereCondition:="Mth= 'L1' AND ID_CUST_SOLDTO = '" & Me.txtIdCust & "'"
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38770522
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

0
 
LVL 1

Author Closing Comment

by:Scamquist
ID: 38770551
Thank you for the assist.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question