Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 15th, 2005, 11:34 AM
Authorized User
 
Join Date: Jan 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add Filter to a query using VB

Anyone have any idea how I can add a filter to a query for a checkbox button. I use the checkbox to either list all products or with quantity >0. This form also works on 6 filters that use a combo box and those work fine. I just need to add one more filter for the checkbox. How can I do that.

    Me.FilterOn = False
    Me.Filter = "Qty >0"
    Me.FilterOn = True
    Me.Refresh

The above code does not seem to work for me

 
Old March 18th, 2005, 12:00 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

Since you have other filters that are working fine, you must be using similar code and, for all intents and purposes, know what you're doing.

My suggestion would be to try putting the filter in a query and make sure you're getting the syntax for your Me.Filter value correct...

Go to the Quantity field in your query, enter the criteria >0, change to SQL view of the query and extract the string that follows the "Where" clause in the query. It might be as simple as needing a space between > and 0.

You might also try Me.Requery instead of Me.Refresh.

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
 
Old March 20th, 2005, 07:03 AM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As I understood your problem, your using a limited procedure True and False.

You might use SQL code in VBA instead and control your query.

A bit of practice, is waht you need.









Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to do a sql web query/filter u2clone ASP.NET 2.0 Basics 15 July 21st, 2007 08:49 AM
Help for Select SQL Query with date filter pushpa SQL Server DTS 0 February 6th, 2007 10:06 AM
Add fields to a query stealthdevil Access VBA 3 November 16th, 2006 12:59 PM
Need help with a query to add records chacquard Access VBA 1 February 28th, 2005 04:23 PM
using a query to filter forms lizhaskin Access 6 June 10th, 2004 06:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.