[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 36
  • Last Modified:

Open Args for report

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
SteveL13
Asked:
SteveL13
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
Your off by an argument:

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

Jim.
0
 
SteveL13Author Commented:
Perfect!!!  Thank you Jim.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now