Solved

Open Args for report

Posted on 2016-07-26
2
28 Views
Last Modified: 2016-07-26
I am having trouble with the following code and need help.  On a form I have  two comboboxes.  One of them named cboFacility and the other one named cboMemberName.  When the user click a command button on the form I have this code in the onclick event.  But when I click it I get a type mismatch error.

    If Len(Trim(Me.cboFacility)) > 0 Then strWhereCondition = strWhereCondition & "([Facility].[FacilityID] IN (" & Me.cboFacility & ")) AND "
    If Len(Trim(Me.cboMemberName)) > 0 Then strWhereCondition = strWhereCondition & "([Member Table].[MemberID] IN (" & Me.cboMemberName & "))"
    If Right(strWhereCondition, 5) = " AND " Then strWhereCondition = Left(strWhereCondition, Len(strWhereCondition) - 5)
    
    DoCmd.OpenReport "rptClinicalNoteReport", acViewPreview, , "", strWhereCondition, acNormal

Open in new window


Can anyone offer a solution?
0
Comment
Question by:SteveL13
[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
2 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 41729484
Your off by an argument:

DoCmd.OpenReport "rptClinicalNoteReport", acViewPreview, , strWhereCondition, acNormal

Jim.
0
 

Author Closing Comment

by:SteveL13
ID: 41729548
Perfect!!!  Thank you Jim.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

749 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