Solved

Open Access 2010 drill through with multiple criteria

Posted on 2013-01-12
3
483 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

691 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