Data mismatch in criteria - driving me nuts!

  • Thread starter Thread starter R Fourt
  • Start date Start date
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?
 
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
 
Back
Top