467,864 Members | 1,717 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,864 developers. It's quick & easy.

date filter not working

I'm trying to put a filter into some forms or filters but the filter
donīt work properly.

I'm using the format dd-mm-yyyy. The forms and the tables always shows
how dates in that format. But when i put filters i donīt get the
expected res result in fact some times i donīt get any result.

I al ready try this filters

date = #08/05/2006#

date <= #08/05/2006#

date between #07/05/2006# and #09/05/2006#

i al ready try use # format(08/05/2006, "dd-mm-yyyy") # in each filter
and still don't work.
I hope you can help me
thanx

May 23 '06 #1
  • viewed: 6468
Share:
3 Replies
chucher wrote:
I'm trying to put a filter into some forms or filters but the filter
donīt work properly.

I'm using the format dd-mm-yyyy. The forms and the tables always shows
how dates in that format. But when i put filters i donīt get the
expected res result in fact some times i donīt get any result.

I al ready try this filters

date = #08/05/2006#

date <= #08/05/2006#

date between #07/05/2006# and #09/05/2006#

i al ready try use # format(08/05/2006, "dd-mm-yyyy") # in each
filter and still don't work.
I hope you can help me
thanx


Date literals in Access queries/filters must use US format, ISO format, or an
unambiguous format where the month uses alpha characters. Your regional
settings and internal format settings do not matter.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 23 '06 #2
There's not nearly enough information here to come to a decision on what's
wrong. What data type field is used to store the dates. Are you storing
dates in a table? How are you trying to filter? More info please.
May 23 '06 #3
I change it to US format and it seems to work fine thanx

this is the complete code Iīm using to open another form and and
filter the information

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "invoice"
stLinkCriteria = ""

If (Not IsNull(txtDate) And IsNull(txtEndDate)) Then
'format(txtDate, "mm-dd-yyyy")
If (stLinkCriteria <> "") Then
stLinkCriteria = stLinkCriteria & " And "
End If
stLinkCriteria = stLinkCriteria & "date = #" & Format(txtDate,
"mm-dd-yyyy") & "#"
End If
If (IsNull(txtDate) And Not IsNull(txtEndDate)) Then
If (stLinkCriteria <> "") Then
stLinkCriteria = stLinkCriteria & " And "
End If
stLinkCriteria = stLinkCriteria & "date <= #" &
Format(txtEndDate, "mm-dd-yyyy") & "#"
End If
If (Not IsNull(txtDate) And Not IsNull(txtEndDate)) Then
If (stLinkCriteria <> "") Then
stLinkCriteria = stLinkCriteria & " And "
End If
stLinkCriteria = stLinkCriteria & "date BETWEEN #" &
Format(txtDate, "mm-dd-yyyy") & "# And #" & Format(txtEndDate,
"mm-dd-yyyy") & "#"
End If
If (Not IsNull(cmbClient)) Then
If (stLinkCriteria <> "") Then
stLinkCriteria = stLinkCriteria & " And "
End If
stLinkCriteria = stLinkCriteria & "idClient = " & cmbClient
End If

Debug.Print stLinkCriteria

DoCmd.OpenForm stDocName, , , stLinkCriteria

May 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by DD | last post: by
2 posts views Thread by DD | last post: by
4 posts views Thread by Stewart Allen | last post: by
3 posts views Thread by Gerry Abbott | last post: by
2 posts views Thread by MajorTom | last post: by
3 posts views Thread by randy1200 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.