Data mismatch in criteria - driving me nuts!

R

R Fourt

I have a form that is called when a user prints one of several reports. The
user selects the Month, Year and, if appropriate, an Officer upon which to
report. If an Officer specific report is requested, the Officer combobox is
enabled, otherwise, not.

Each report is based on a query that includes a calculated field called
"MonthYear" which results in strings such as "April 2009", "May 2009", etc

The report is then run with the criteria established by the form.

The problem is this: When I set the criteria with no Officer, I get the Data
mismatch in criteria" error. When I run an Officer based report it works fine.

Here's the code for the "Print" button that establishes the report criteria

strCriteria = "[MonthYear] = '" & strMonth & " " & strYear & "'"

If Me.cmbDIN.Enabled Then
If IsNull(Me.cmbDIN) Then
MsgBox "You must select an Officer on which to report!", vbCritical,
"No Officer Selected"
Me.cmbDIN.SetFocus
Me.cmbDIN.Dropdown
Exit Sub
End If
strCriteria = strCriteria & " AND [DIN] = " & Me.cmbDIN.Column(0)
End If

Gahhhh!

Any thoughts?
 
R

R Fourt

Why is it that I work for hours on a problem and as soon as I post a question
to the forum, I find the answer?

I had some records with missing dates...

Thanks anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top