Error in Dcount criteria date format

safeerbinsalih

Registered User.
Local time
Today, 20:17
Joined
Dec 30, 2015
Messages
26
Error in Dcount criteria

I need to count number of records in a table (tblData_save) with with date field given in criteria. Date field is taken from a form (frmTransaction_input). The code is as follows

temp1 = DCount("*", "tblData_save", "[Enter_date] = #" & Format(Forms!frmTransaction_input.[Enter_date], "dd-mm-yyyy") & "#")

My date format is short date in Indian format dd-mm-yyyy.

Here the count is always returning 0 value. Criteria is not working.

Any help is appreciated
 
..
temp1 = DCount("*", "tblData_save", "[Enter_date] = #" & Format(Forms!frmTransaction_input.[Enter_date], "dd-mm-yyyy") & "#")
Try the below:
Code:
temp1 = DCount("*", "tblData_save", "[Enter_date] = #" &  Format(Forms!frmTransaction_input[B][COLOR=Red]![/COLOR][/B][Enter_date], "[B][COLOR=Red]mm/dd/yyyy[/COLOR][/B]") & "#")
 
Thanks JHB, But it is not working. Still the count is returning 0 value
 
Try to replace it with a hard coded value, (change the date):
Code:
temp1 = DCount("*", "tblData_save", "[Enter_date] = #03/03/2016#)"
Else post your database with some sample data, (zip it) + where you've the problem.
 
try to use English (EN) format date:

temp1 = DCount("*", "tblData_save", "[Enter_date] = #" & Format(Forms!frmTransaction_input![Enter_date], "mm/dd/yyyy") & "#")
 
try to use English (EN) format date:

temp1 = DCount("*", "tblData_save", "[Enter_date] = #" & Format(Forms!frmTransaction_input![Enter_date], "mm/dd/yyyy") & "#")
That was suggested in post #2.
 

Users who are viewing this thread

Back
Top Bottom