Filtering records based on field on a form

  • Thread starter ondvirg via AccessMonster.com
  • Start date
O

ondvirg via AccessMonster.com

I know this is probably pretty simple, so I apologize for my ignorance...but,
I'd like to assign code to the field in a continuous form that when double
clicked will filter all the records based on the value of that field in the
active record being dblclicked.
 
F

fredg

I know this is probably pretty simple, so I apologize for my ignorance...but,
I'd like to assign code to the field in a continuous form that when double
clicked will filter all the records based on the value of that field in the
active record being dblclicked.

Any reason why the user can't simply enter the control and click on
the Filter by Selection tool button?

However, if you must 'do-it-yourself' .....
The field is what datatype? Text? Number? Date?

For example, if the field datatype is Text, you can code the control's
Double-click event:
Me.Filter = "[ThisControlName] = """ & Me.[ThisControlName] & """"
Me.FilterOn = True

Look up
Restrict data to a subset of records
in VBA help to learn the correct syntax for Text , Number, and Date
datatypes.
 
O

ondvirg via AccessMonster.com

Thanks for the help. Yeah, you'd think it should be that easy, but the users
here have a different mind set :)
I know this is probably pretty simple, so I apologize for my ignorance...but,
I'd like to assign code to the field in a continuous form that when double
clicked will filter all the records based on the value of that field in the
active record being dblclicked.

Any reason why the user can't simply enter the control and click on
the Filter by Selection tool button?

However, if you must 'do-it-yourself' .....
The field is what datatype? Text? Number? Date?

For example, if the field datatype is Text, you can code the control's
Double-click event:
Me.Filter = "[ThisControlName] = """ & Me.[ThisControlName] & """"
Me.FilterOn = True

Look up
Restrict data to a subset of records
in VBA help to learn the correct syntax for Text , Number, and Date
datatypes.
 
C

Chegu Tom

It is often easier to change the code than the user.

Programming would be so much easier without users. :)

ondvirg via AccessMonster.com said:
Thanks for the help. Yeah, you'd think it should be that easy, but the
users
here have a different mind set :)
I know this is probably pretty simple, so I apologize for my
ignorance...but,
I'd like to assign code to the field in a continuous form that when
double
clicked will filter all the records based on the value of that field in
the
active record being dblclicked.

Any reason why the user can't simply enter the control and click on
the Filter by Selection tool button?

However, if you must 'do-it-yourself' .....
The field is what datatype? Text? Number? Date?

For example, if the field datatype is Text, you can code the control's
Double-click event:
Me.Filter = "[ThisControlName] = """ & Me.[ThisControlName] & """"
Me.FilterOn = True

Look up
Restrict data to a subset of records
in VBA help to learn the correct syntax for Text , Number, and Date
datatypes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top