Re: DCount

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Mark wrote:
> I used a text box instead of Cal and it did work, so looks like some
> format issue.
>
> However, I'm still getting some errors in my data from the field
> being (in the table) a combination of Date and time. Ex: 07/25/2005
> 5:09:35 PM
>
> When I run:
> vStr = DCount("WORK_REQ_ID", "VIAWARE_WCS_TO_VIA_T", "DTIMEMOD =
> #07/13/2005#"
>
> It shows none. What would I use to only see the date in a field?

There's the "easy but inefficient" method...
vStr = DCount("WORK_REQ_ID", "VIAWARE_WCS_TO_VIA_T", "DateValue(DTIMEMOD) =
#07/13/2005#"

And there's the more difficult but more efficient method...
vStr = DCount("WORK_REQ_ID", "VIAWARE_WCS_TO_VIA_T", "DTIMEMOD BETWEEN
#07/13/2005# AND #7/14/2005#")

If you think there's any chance of having records with exactly midnight then
you have to use...
vStr = DCount("WORK_REQ_ID", "VIAWARE_WCS_TO_VIA_T", "DTIMEMOD BETWEEN
#07/13/2005# AND #7/13/2005 23:59:59#")

The efficiency issue is that you (whenever possible) want to apply criteria
to a field directly rather than to an expression containing the field. The
latter prevents the database engine from being able to utilize an index
forcing a row by row table scan.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.



Relevant Pages

  • Re: DCOUNT problem with numbers stored as text
    ... The reason you might want to get away from the D functions is that they are ... I learned them was because the criteria is similar to the advanced filter ... am programatically populating the raw data. ... only way I have found to avoid data format errors on import is ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Collecting Data Via Email
    ... formats (criteria is a date the data being updated/collected is number). ... "Pete D." ... Test your criteria for unlike data format. ... Also if it is from outlook then access expects the ...
    (microsoft.public.access.externaldata)
  • Re: Collecting Data Via Email
    ... pduffy AT cox DOT net It sounds like a minor mistake maybe new eyes. ... formats (criteria is a date the data being updated/collected is number). ... "Pete D." ... Test your criteria for unlike data format. ...
    (microsoft.public.access.externaldata)
  • Re: Collecting Data Via Email
    ... formats (criteria is a date the data being updated/collected is number). ... Test your criteria for unlike data format. ... sent from a select query that has calculated date fields. ... Also if it is from outlook then access expects the field ...
    (microsoft.public.access.externaldata)
  • Re: dates in macros
    ... If you record a macro when you do it manual the macro recorder record the system Date format and that is not working when you have another Date format as US on your system. ... us to create a criteria string that will locate an exact match in all locales. ... When using any of the other filter ...
    (microsoft.public.excel.programming)