Clarification on Date format

Kindly check whether the arrangement of the SQL below with date format is Okay:

SELECT Qry10003CustomerLedgerunion.CustomerID, Qry10003CustomerLedgerunion.AccountID, Qry10003CustomerLedgerunion.Company, Qry10003CustomerLedgerunion.InvoiceID, Qry10003CustomerLedgerunion.CDate, Qry10003CustomerLedgerunion.Debit, Qry10003CustomerLedgerunion.Credit, ([Debit]-[Credit]) AS Balance, Qry10003CustomerLedgerunion.Reference
FROM Qry10003CustomerLedgerunion
WHERE (((Qry10003CustomerLedgerunion.CustomerID)=[Forms]![frmCityLedger]![CboCustomerID]) AND ((Qry10003CustomerLedgerunion.AccountID)=[Forms]![frmCityLedger]![CboAccountId]) AND ((Qry10003CustomerLedgerunion.CDate) Between Format(([Forms]![frmCityLedger]![txtDateA]),"yyyy\/mm\/dd") And Format(([Forms]![frmCityLedger]![txtEndB]),"yyyy\/mm\/dd")));

At the moment I have no issues the query seam to be working properly , but I just want a second opinion on this.

Regards

Chris
LVL 2
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScDirectorAsked:
Who is Participating?
 
Pawan KumarDatabase ExpertCommented:
This format (yyyy\/mm\/dd) is good. Continue with the this or use below

yyyymmdd

Above is what is use and it works in all the cases.
0
 
Ryan ChongCommented:
considering [Forms]![frmCityLedger]![txtDateA] and [Forms]![frmCityLedger]![txtEndB] are textbox controls, they stored what you have entered.

if these controls already contain values in yyyy/mm/dd, what's the reason to re-format it again to yyyy/mm/dd?
0
 
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScDirectorAuthor Commented:
considering [Forms]![frmCityLedger]![txtDateA] and [Forms]![frmCityLedger]![txtEndB] are textbox controls, they stored what you have entered.

if these controls already contain values in yyyy/mm/dd, what's the reason to re-format it again to yyyy/mm/dd?

No format at control text only the query itself!

Regards

Chris
0
 
Ryan ChongCommented:
what i'm emphasizing is if your value already in format of yyyy/mm/dd, what for to format it again using format function?

anyway, it's your choice
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.