Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 15th, 2005, 11:34 AM
Authorized User
Join Date: Jan 2005
Location: , , .
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

The above code does not seem to work for me

Reply With Quote
  #2 (permalink)  
Old March 18th, 2005, 12:00 AM
Friend of Wrox
Join Date: Nov 2004
Location: Seattle, WA, .
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post

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
Reply With Quote
  #3 (permalink)  
Old March 20th, 2005, 07:03 AM
Authorized User
Join Date: Mar 2005
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

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.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 07:45 AM.

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