Reputation: 111
In my country we use the format 2020. 09. 31. When I try to use it to build SQL query it dosn't works.
IncomingInvoiceList.RowSource = "SELECT InvoiceDate, DistributorName FROM IncomingInvoice WHERE InvoiceDate BETWEEN #2020/04/31# AND " & TextBox & ")"
The static #2020/04/31# format is ok, but the TextBox data (short format in our country) not. How to cast it?
Upvotes: 1
Views: 337
Reputation: 55806
Format your textbox value as a string expression for the date - and don't include an invalid day of April:
IncomingInvoiceList.RowSource = "SELECT InvoiceDate, DistributorName FROM IncomingInvoice WHERE InvoiceDate BETWEEN #2020/04/30# AND #" & Format(TextBox, "yyyy\/mm\/dd") & "#)"
Upvotes: 1