Problem filtering report

  • Thread starter Thread starter TK
  • Start date Start date
T

TK

I am having a problem sending this simple WHERE clause in my openreport
command:
DoCmd.OpenReport stDocName, acViewPreview, , , "[InvoiceDate] =#" &
Me.cmbInvoiceDate & "#"

The report comes back with no records - but there are in fact records that
match.
Is my problem that the report is grouped based on the Invoice date - and if
so, how can I get around it?
I have a form which opens when they go to the report menu so they can choose
to print all invoices or just ones for certain dates (still would be all
invoices - just from that date).
Thanks in advance.
TK
 
Access is probably misunderstanding the data type or the date format.

1. If cmbInvoiceDate is unbound, set its Format property to Short Date or
similar. This tells Access to treat it as a date, and prevents entry of
invalid dates.

2. Explicitly format the literal date in the WhereCondition:
"[InvoiceDate] = " & Format(Me.cmbInvoiceDate, "\#mm\/dd\/yyyy\#")

3. Drop a comma. There should only be 2 before the WhereCondition.
(I'm guessing you have this right in your actual database, and the error is
just in the post.)
 
Back
Top