Most of my work these days is with Azure SQL backends and Access FE 's.
This query should fail SQL Server,
Code:
SELECT PrimaNota.Ricevuta, PrimaNota.[Conto N], Pianodeiconti2.Descrizione, PrimaNota.Data, PrimaNota.Entrate, PrimaNota.Uscite, PrimaNota.Note, Pianodeiconti2.LIVELLO_1, Pianodeiconti2.LIVELLO_2, Pianodeiconti2.INDICE, PrimaNota.MESE, Pianodeiconti2.CODICE_REGIONE_AVERE, Pianodeiconti2.CODICE_REGIONE_DARE, Pianodeiconti2.RAGGRUPPAMENTO1FROM Pianodeiconti2 INNER JOIN PrimaNota ON Pianodeiconti2.[Conto N] = PrimaNota.[Conto N]
WHERE (((PrimaNota.Data) BETWEEN #31/12/1023# AND #01/01/2025#)) ORDER BY PrimaNota.Data, PrimaNota.[Conto N];
as it won't understand the Date delimiters being # and won't understand the dd/mm/yyyy date format either.
I always use 'yyyy-MM-dd' format for Sql Server.
I use the function below to take normal access dates or dates as string
Code:
Function ServerDate(varDate As Variant) As String
'Purpose: Return a delimited string in the date format used natively by SQL Server and Azure SQL.
'Argument: A date/time value.
'Note: Returns just the date format if the argument has no time component,
' or a date/time format if it does.
'Author: Adjusted from a Allen Browne function for user with SQL server. allen@allenbrowne.com, June 2006.
If IsDate(varDate) Then
If DateValue(varDate) = varDate Then
ServerDate = Format$(varDate, "'yyyy-mm-dd'")
Else
ServerDate = Format$(varDate, "'yyyy-mm-dd hh:nn:ss'")
End If
End If
End Function