I want to count the total of [IDs] in a table called "myTable" where the [created_date] is equal to 10/5/07 and where the [data_store] is equal to "INS" and where the [status] is equal to "active" or "open" or "accepted" or "activated" or like "pending". My expression doesn't return the correct records. If I run a query using that criteria it works. I tried using the syntax the query uses in the SQL view but of course that's SQL and the syntax for an expression in a control on a report is different. Please help me. This is what I put in my control on my report:
And this is what the SQL syntax is
which returns the right data)
Code:
=DCount("[ID]","tblWeeklyNumbers"," [data_store] = 'INS' and [created] <= Forms!frmDateRange_forWeeklyStatRpt![txtend] And [status] = 'active' or [status] like '*Pending*' or [status] = 'open' or [status] = 'accepted' or [status] = 'activated'")
And this is what the SQL syntax is
Code:
SELECT tblWeeklyNumbers.Id, tblWeeklyNumbers.created, tblWeeklyNumbers.Data_Store, tblWeeklyNumbers.Status
FROM tblWeeklyNumbers
WHERE (((tblWeeklyNumbers.created)<=#10/5/2007#) AND ((tblWeeklyNumbers.Data_Store)="ins") AND ((tblWeeklyNumbers.Status) Like "*Pending*" Or (tblWeeklyNumbers.Status)="active" Or (tblWeeklyNumbers.Status)="activated" Or (tblWeeklyNumbers.Status)="'accepted" Or (tblWeeklyNumbers.Status)="open"));