formated date filter

Marta

Registered User.
Local time
Today, 07:24
Joined
Apr 8, 2011
Messages
16
Hi
I am trying to set up a date filer. Start is a date field and it is set to short date. Find is a text box and is too set to short date (I use Find.Format = "Short Date"). I want to filter field Start based on the date in text box Find. I tried a few variations but nothing works. These are some examples of codes and the error messages.
Code:
Filter = "Start ='" & Find & "'" - datatype mismatch

Filter = "Start = #" & Find & "#" - run-time error 3000 (reserved error (-3201))

Filter = "Start =" & Find & " "
Filter = "Start =" & Find  - syntax error (missing operator) in query expression 'Start = 5. 11. 2010'

But when I use this code: Filter = "Start = Find " and I inset a date to Find then it works.
Thanks for help.
 
The problem is that I want to filter field Start based on the date in text box Find. When I use this code: Filter = "Start = Find " it doesn't use the text box it ask me to inset the date into the message box (I don't know how is it called). I want filter to use the date in the text box Find but this code Filter = "Start ='" & Find & "'" doesn't work.
 
The Reserved Word list at AllenBrowne's website doesn't say Find is a reserved word but I wonder.
I will use txtFind in the following examples.

Really you should be using the fully reference to the objects too.

If you refer directly to the box you can use this:
Code:
Me.Filter = "Start = Forms!formname.txtFind"

Otherwise use:

Code:
Me.Filter = "Start =#" & Me.txtFind & "#"

Allen's list says Start is a future reserved word though. :eek:
 
Last edited:

Users who are viewing this thread

Back
Top Bottom