Question:
ms access 2007 - need help with dcount?
IHateNicknames
2009-06-01 12:52:54 UTC
i have a small db, with a form that has a textbox called DateTextBox, i am tring to use the expression builder to have another textbox track the count of records that match the DateTextBox date value

but it always returns 0 records, my expression is below

what am i doing wrong? thanks for any and all help

=DCount("*","[ticket table]","[ticket date]=" & [Forms]![ticket form]![DateTextBox])
Five answers:
topherG
2009-06-01 13:08:22 UTC
Try placing the pound sign around your date, like this:



=DCount("*","[ticket table]","[ticket date] = #" & [Forms]![ticket form]![DateTextBox] & "#")



Access requires you to identify dates in a SQL query by surrounding it with pound signs.



If the date was 7/18/09, then your query would be:

SELECT Count(*) FROM [ticket table] WHERE [ticket date] = #7/18/09#



Let me know if this works out for you.
haltom
2016-12-18 21:05:23 UTC
Dcount Access
?
2016-10-28 22:22:47 UTC
Access Dcount
2009-06-01 13:25:50 UTC
I don't know what it is you are exactly trying to accomplish but here is a solution....



create a parameter query with something like this...



I am using a table name dates and a field named startdate in my table



SELECT Count(dates.startdate) AS CountOfstartdate, dates.startdate

FROM dates

GROUP BY dates.startdate

HAVING (((dates.startdate) Like [Enter Date:] & "*"));



The parameter query ask for a date and will return the count for the inputted value...please note that the matches have to be exact...



3/19/2009 will retun the count of records with a date of 3/19/2009

but

03/19/2009 will not show and 3/19/2009 because of the leading zero....



I have years of Microsoft Access and if you want to add or need something, don't hesitate...
jagdeesh
2016-10-06 07:56:02 UTC
For calculating documents and showing result on basically decide on question. bypass to layout view of decide on question, decide for table and drag required columns. provide calculating new column like HRA:field call of user-friendly pay*8/one hundred Then decide on run button from toolbar, now you get datasheet view with calculating momentary fields thank you


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...