set a filter by command button

D

david

Is ther a way to have a commmand button set a filter for
a form by a particular field when you click it?
 
R

Rick Brandt

david said:
Is ther a way to have a commmand button set a filter for
a form by a particular field when you click it?

Example on a numeric field:
Me.Filter = "[YourFieldName]=" & YourFilterValue
Me.FilterOn = True

Example on a text field:
Me.Filter = "[YourFieldName]='" & YourFilterValue & "'"
Me.FilterOn = True
 
D

david

If I want YourFilterValue to use what ever is in the
YourFieldName dependent on the record I am on what would
I use?
-----Original Message-----
david said:
Is ther a way to have a commmand button set a filter for
a form by a particular field when you click it?

Example on a numeric field:
Me.Filter = "[YourFieldName]=" & YourFilterValue
Me.FilterOn = True

Example on a text field:
Me.Filter = "[YourFieldName]='" & YourFilterValue & "'"
Me.FilterOn = True



--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com



.
 
R

Rick Brandt

david said:
If I want YourFilterValue to use what ever is in the
YourFieldName dependent on the record I am on what would
I use?

Example on a numeric field:
Me.Filter = "[YourFieldName]=" & Me!YourFieldName
Me.FilterOn = True

Example on a text field:
Me.Filter = "[YourFieldName]='" & Me!YourFieldName & "'"
Me.FilterOn = True
 
D

david

Works Great Thanks
-----Original Message-----
david said:
If I want YourFilterValue to use what ever is in the
YourFieldName dependent on the record I am on what would
I use?

Example on a numeric field:
Me.Filter = "[YourFieldName]=" & Me!YourFieldName
Me.FilterOn = True

Example on a text field:
Me.Filter = "[YourFieldName]='" & Me!YourFieldName & "'"
Me.FilterOn = True



--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
 
A

Adrian Jansen

Just use the built-in right click menu - allows you to put the cursor in any
field, right click, select Sort, and have the form sorted by that field. No
buttons, no code, just user education.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 

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