Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons to Filter Form

Status
Not open for further replies.

Mactavishman

IS-IT--Management
Mar 11, 2002
4
US
Creating a Form to add/edit records in a Purchase Order Requisition database. I need a way to filter the form so that the records only show the year indicated (The year field is already defined in the underlying table). Thinking Buttons that when you click on them filter for records from 2002, 2003, 2004, etc. Or maybe a combo box. Then you can add records to the table.

Be gentle! I'm not a strong programmer!

Thanks,

Craig
craig@hometechtexas.com
 
I put a button on the form and then created a macro and then use the macro in the click event of the button. There are some sample macros in Northwind to study, they are not to difficult to do and once you know how to use them, they are a pretty handy tool.
 
Craig:

Look into the form's filter property (Help: Filter Property)

Add a command button to your form and in the on click event add code similar to this:

Me.Filter = "Country = 'USA'"
Me.FilterOn = True

For "Country" substitute the field name for the year;
for 'USA' substiture the year value. If the field is text, enclose it in single quotes.

It's a good idea to add a command button to turn the filter off also (Me.FilterOn = False).

Hope this helps. Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top