Charlotte Foust
charlotte.foust at gmail.com
Thu Sep 22 13:49:37 CDT 2011
Here's what MS suggests: Function MakeUSDate(DateIn As Variant) As String ' Do nothing if the value is not a date. If Not IsDate(DateIn) Then Exit Function ' Convert the date to a U.S. Date format. MakeUSDate = "#" & Month(DateIn) & "/" & Day(DateIn) & "/" & Year(DateIn) & "#" End Function I would suggest that if you're using SQL Server as an alternative BE you also have a function to return the proper date delimiter. Charlotte Foust On Thu, Sep 22, 2011 at 11:36 AM, Rocky Smolin <rockysmolin at bchacc.com>wrote: > Dear List: > > Because I'm old and can't remember (and the archives are down), I was told > how to filter with dates so that if a user is using international dates it > doesn't matter. > > The following code: > > If Nz(Forms!frmPOReport!txtGEPromisedDate) <> "" Then > If Len(strSQL) <> 0 Then strSQL = strSQL & " AND " > strSQL = strSQL & "fldPOPromisedDate >= #" & > Forms!frmPOReport!txtGEPromisedDate & "# " > End If > > If Nz(Forms!frmPOReport!txtLEPromisedDate) <> "" Then > If Len(strSQL) <> 0 Then strSQL = strSQL & " AND " > strSQL = strSQL & "fldPOPromisedDate <= #" & > Forms!frmPOReport!txtLEPromisedDate & "# " > > strSQL eventually ends up in Me.Filter. > > Works good in the USA. :) Fails in Nicaragua. :( > > Was it CDate I was supposed to use? > > Sorry for the redux. > > TIA > > Rocky > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > > > Website: http://www.databaseadvisors.com > > >