By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,823 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

filtering data based on an user input on a form

P: n/a
Hi
Given a form with a date formated text box on it, which will serve as an
input box for dates, how can I write a VBA sentence in order to apply a
filter with that input?

Suppose text box is "TEXT13" and the table field is "Data of birth".

When I run a code like this
DoCmd.ApplyFilter , "[date of birth] = " & "#" &
Me.[Text13] & "#"
I get no trustful results.

Thank you.
A_Rodrigues
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"A_Rodrigues" <am*************@netvisao.pt> wrote in
news:ne********************@newsfront4.netvisao.pt :
Hi
Given a form with a date formated text box on it, which will
serve as an input box for dates, how can I write a VBA
sentence in order to apply a filter with that input?

Suppose text box is "TEXT13" and the table field is "Data of
birth".

When I run a code like this
DoCmd.ApplyFilter , "[date of birth] =
" & "#" &
Me.[Text13] & "#"
I get no trustful results.

Thank you.
A_Rodrigues

I much prefer to set the form's .filter and .FilterOn properties in
code.

me.filter = "[date of birth] = #" & Me.[Text13] & "#"
me.filteron = true

Nov 12 '05 #2

P: n/a
Hi
Unfortunatly, it works fine but for one particular date (February 1st 2002).
Does someone have any idea?
Thank you.
A_Rodrigues

"Bob Quintal" <bq******@generation.net> wrote in message
news:a0******************************@news.teranew s.com...
"A_Rodrigues" <am*************@netvisao.pt> wrote in
news:ne********************@newsfront4.netvisao.pt :
Hi
Given a form with a date formated text box on it, which will
serve as an input box for dates, how can I write a VBA
sentence in order to apply a filter with that input?

Suppose text box is "TEXT13" and the table field is "Data of
birth".

When I run a code like this
DoCmd.ApplyFilter , "[date of birth] =
" & "#" &
Me.[Text13] & "#"
I get no trustfull results.

Thank you.
A_Rodrigues

I much prefer to set the form's .filter and .FilterOn properties in
code.

me.filter = "[date of birth] = #" & Me.[Text13] & "#"
me.filteron = true

Nov 12 '05 #3

P: n/a
What are you actually putting in the text box? To use # delimiters like
that, it must be in mm/dd/yyyy format, or some unambiguous format.

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

"A_Rodrigues" <am*************@netvisao.pt> wrote in message
news:ne********************@newsfront4.netvisao.pt ...
Hi
Unfortunatly, it works fine but for one particular date (February 1st 2002). Does someone have any idea?
Thank you.
A_Rodrigues

"Bob Quintal" <bq******@generation.net> wrote in message
news:a0******************************@news.teranew s.com...
"A_Rodrigues" <am*************@netvisao.pt> wrote in
news:ne********************@newsfront4.netvisao.pt :
Hi
Given a form with a date formated text box on it, which will
serve as an input box for dates, how can I write a VBA
sentence in order to apply a filter with that input?

Suppose text box is "TEXT13" and the table field is "Data of
birth".

When I run a code like this
DoCmd.ApplyFilter , "[date of birth] =
" & "#" &
Me.[Text13] & "#"
I get no trustfull results.

Thank you.
A_Rodrigues

I much prefer to set the form's .filter and .FilterOn properties in
code.

me.filter = "[date of birth] = #" & Me.[Text13] & "#"
me.filteron = true


Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.