Error Type mismatch to open a Report in Ms Access

Glen17

Registered User.
Local time
Today, 09:50
Joined
Jul 7, 2016
Messages
13
Hello everyone!

I am working with Ms Access 2007-2013 file format.

I have a Report should be open, but every time I open the Report using the command button in a Form I've got Run time error '13' Type mismatch.

Here's the code of a Report that I am trying to open
Code:
Private Sub btnMonthlyReport_Click()
Dim task, strCriteria As String
DoCmd.OpenReport "Simulation-AveragePerMonth", acViewPreview, task
End Sub

Please help me for this. Any response is much appreciated . Thanks!
 
there will be an issue in the query record source of the report.

try opening that on its own to identify the problem.

maybe a number is blank (null). That might produce this problem.
 
You haven't assign anything to the variable task, so why are you have it in when you open the report, remove it.
DoCmd.OpenReport "Simulation-AveragePerMonth", acViewPreview, task
 
You haven't assign anything to the variable task, so why are you have it in when you open the report, remove it.

I already do this but nothing is new, it is the same error..:(
 
there will be an issue in the query record source of the report.

try opening that on its own to identify the problem.

maybe a number is blank (null). That might produce this problem.

I dont know what something is wrong in this. I can't find it. What I am trying to do is using the Command button in Form, the codes of Command button is
Code:
Private Sub btnMonthlyReport_Click()
Dim task, strCriteria As String
DoCmd.OpenReport "Simulation-AveragePerMonth", acViewPreview, task
End Sub

Then when the Command button is click the Error occure saying "Run-time error '13'. Type mismatch".

Please help me with this. Any response is very much appreciated thanks!
 
Then post your database with some sample data in it, and the name of the form in which the problem occur, zip it.
 
Then post your database with some sample data in it, and the name of the form in which the problem occur, zip it.

I tried to zip it, but this system requires only 200 MB. Though I already remove unneccessary data still it exceeds more than 200 MB. Do I have a way to do this? Thanks
 
What is the purpose of ,task in your OpenReport?

This Dim task, strCriteria As String does not do what you think, but I don't think it is related to your issue.
Dim task, strCriteria As String will Dim task as a Variant, and strCriteria as a string.
In Access you must explicitly dim variables, otherwise they are dimmed as Variants.

Why have this line since you don't seem to use it?
Code:
Dim task, strCriteria As String

As for your database, have you done a compact and repair before trying to zip?
 

Users who are viewing this thread

Back
Top Bottom