A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Filter - Access 2003



 
 
Thread Tools Display Modes
  #11  
Old December 7th, 2005, 12:35 AM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Date Filter - Access 2003

Got it! That was exactly the trick!

Thanks a ton for the great eyes!

Darhl


"Douglas J. Steele" wrote in message
...
Missed the fact that your filter is actually incorrect. It's =, not =.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Darhl Thomason" wrote in message
...
Doug,

It is at the end of the routine that is generating the filter. The
actual line is:
Me.Filter = strFilter

When I was working through some other filter problems, I found that this
is usually because there is an invalid character that the filter doesn't
like...I don't know enough about filters, especially date filters to know
what exactly it doesn't like.

Thanks!!

d

"Douglas J Steele" wrote in message
...
When the error message is generated, what's the actual line of code it's
complaining about? Is it in your routine that's generating the filter,
or is
it somewhere else in your code?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Darhl Thomason" wrote in message
...
Make that filter line:
(tblStoreData.StatusID = 2) And (tblStoreData.InstallDate =
#12/01/2005#)

"Darhl Thomason" wrote in message
...
I also tried changing the date delimiter to # instead of ". I'm still
getting the error. My filter text now looks like:
(tblStoreData.StatusID = 2) And (tblStoreData.InstallDate =
#12/01/05#)

My code for building the filter now looks like"
'Start Install Date Filter
If Not IsNull(Me.txtInstallStartDate) Then
If Not IsNull(strFilter) Then
strFilter = strFilter & " And ("
Else
strFilter = strFilter & "("
End If
strFilter = strFilter & "tblStoreData.InstallDate = #" &
Me.txtInstallStartDate & "#"
setInstallDate = True
End If
If Not IsNull(Me.txtInstallEndDate) Then
If Not IsNull(strFilter) And setInstallDate = False Then
strFilter = strFilter & " And ("
Else
If setInstallDate = True Then
strFilter = strFilter & " And "
Else
strFilter = strFilter & "("
End If
End If
strFilter = strFilter & "tblStoreData.InstallDate = #" &
Me.txtInstallEndDate & "#"
setInstallDate = True
End If
If setInstallDate = True Then
strFilter = strFilter & ")"
End If
'End Install Date Filter

Thanks!

Darhl

"Douglas J. Steele" wrote in
message
...
Dates need to be delimited with # characters, not quotes. (And, for
the
sake of completeness, the dates need to be in mm/dd/yyyy format, or
an
unambiguous format such as yyyy-mm-dd, regardless of what the short
date
format has been set to through Regional Settings)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



"Darhl Thomason" wrote in
message
...
I'm trying to filter my database by date ranges. I have text box
controls for txtInstallStartDate and for txtInstallEndDate. I
believe
I
have the logic worked out to create the filter, but when I add a
date
into the box, it brings up the debug window saying I can't assign a
value to this object. I think it has to do with how my code is
building
the filter string. End result of my filter string is:
(tblStoreData.InstallDate = "12/01/05" And
tblStoreData.InstallDate
=
"12/31/05")

tblStoreData.InstallDate is a Date/Time field with a Short Date
format.
I tried running it without the double quotes in the filter string
but
got the same result.

Here is the code I am using to build the filter string:
'Start Install Date Filter
If Not IsNull(Me.txtInstallStartDate) Then
If Not IsNull(strFilter) Then
strFilter = strFilter & " And ("
Else
strFilter = strFilter & "("
End If
strFilter = strFilter & "tblStoreData.InstallDate = """ &
Me.txtInstallStartDate & """"
setInstallDate = True
End If
If Not IsNull(Me.txtInstallEndDate) Then
If Not IsNull(strFilter) And setInstallDate = False Then
strFilter = strFilter & " And ("
Else
If setInstallDate = True Then
strFilter = strFilter & " And "
Else
strFilter = strFilter & "("
End If
End If
strFilter = strFilter & "tblStoreData.InstallDate = """ &
Me.txtInstallEndDate & """"
setInstallDate = True
End If
If setInstallDate = True Then
strFilter = strFilter & ")"
End If
'End Install Date Filter

Thanks for any help!

Darhl















 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ambiguous Name Error pm Using Forms 10 June 5th, 2005 09:19 PM
Why does my new Access 2003 not recognize Date()? Barb Running & Setting Up Queries 11 May 31st, 2005 03:03 AM
Query for 'confirmation' rogge Running & Setting Up Queries 8 April 19th, 2005 03:26 PM
is Access 2003 any better than XP? Gorb General Discussion 4 November 11th, 2004 09:44 PM
dropdown lists not progressively filtered in MS Access 2003 filter by form Mike O. Using Forms 1 November 9th, 2004 05:07 AM


All times are GMT +1. The time now is 05:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.