Filters, Buttons, Queries, oh my! - 44399

i have a main form with a subform. the main form and the subform are 
unrelated. the subform is based on a query that lists a load of stuff and 
does some calcs that use numbers on the main form with numbers from the 
subform. this all works great.

i have some buttons that allow me to cause a filter to be applied to the 
subform based on the code that i put in the buttons on click event. there are 
6 buttons that turn on a specific filter and 6 other buttons that turn off 
the filter. i know i probably should have used toggle buttons, but as i am 
still learning i wanted to make it easy on myself. these buttons work fine, 
except for one fine detail.

when i click the first filter button it does what it was meant to do, when i 
click the second button it does what it was meant to do on top of the other 
filter the first button did. this is exactly what i want. but when i turn off 
one filter, it turns off all the others.

so here is the code i have for one set of buttons. i am imagining that i 
might need to add something to each, or rewrite to make the previous filter 
remain.

Code:

Private Sub btn10000off_Click()
On Error GoTo Err_btn10000off_Click
    'this is necessary for the calculations on the subform
    RunCommand acCmdSaveRecord

    'this is the code to turn off the filter
    Me.subfrmqryRepPartListCalcWFilter.Form.Filter = ""
    Me.subfrmqryRepPartListCalcWFilter.Form.FilterOn = False

    'this code changes the focus from the button just clicked so that it can 
be disabled and turns on the button that is its opposite
    Me.RepName.SetFocus
    Me.btn10000off.Visible = False
    Me.btn10000off.Enabled = False
    Me.btn10000on.Visible = True
    Me.btn10000on.Enabled = True
    
Exit_btn10000off_Click:
    Exit Sub
Err_btn10000off_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_btn10000off_Click
End Sub

Private Sub btn10000on_Click()
On Error GoTo Err_btn10000on_Click
    'this is necessary for the calculations on the subform    
    RunCommand acCmdSaveRecord
    
    'this is the turning on of the filter
    Me.subfrmqryRepPartListCalcWFilter.Form.Filter = "(([10000Rebuild] = -1))"
    Me.subfrmqryRepPartListCalcWFilter.Form.FilterOn = True

    'this code changes the focus from the button just clicked so that it can 
be disabled and turns on the button that is its opposite
    Me.RepName.SetFocus
    Me.btn10000on.Visible = False
    Me.btn10000on.Enabled = False
    Me.btn10000off.Visible = True
    Me.btn10000off.Enabled = True

Exit_btn10000on_Click:
    Exit Sub
Err_btn10000on_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_btn10000on_Click
End Sub

thanks for any and all suggestions! :)
0
Utf
3/21/2007 8:00:00 PM
access.formscoding 7493 articles. 0 followers. Follow

0 Replies
918 Views

Similar Articles

[PageSpeed] 28

Reply:

Similar Artilces:

Limiting formulas based on filtering?
Is there an easy way to build a formula that will only take values into consideration when the auto format is used. So, if I have a table of data and a formula based on this table and I filter one of my data columns to some vause then I would like my formula to automatically update. Is this possible? Thank you, CH The SUBTOTAL function ignores rows that are hidden by an autofilter (and optionally, also rows that were hidden manually). It can perform a wide range of operations, including sums, averages, counts, standard deviations, products, maximums, minimums, etc. Check E...

Paste Filtered Range to New Workbook- AS
Hello, I recorded a macro and additionally used the DG help to construct the following macro; however, I'm not certain how to copy the filtered range (which will vary every time the worksheet is used) or how to find the last row of the workbook to which the data will be pasted. Any help would be great! And thanks in advance. Sub Macro1() Dim wbname As String Dim copyrange As Range Dim LastRow As Range Dim rng As Range ' Macro1 Macro ' Macro recorded 12/8/2009 by asagay ' wbname = ActiveSheet.Range("g1").Value & ActiveSheet.Range("j1&qu...

Activities don't show up until we hit the refresh button
Hello all, We upgraded from 3 to 4 and it appears that the upgrade did not complete successfuly, but the users used the system. Everything appears to be working well except for a couple of strange things like when we create an activity the activity does not appear until we hit the Refresh button, going to history and coming back does not fix the issue, only the refresh button any quick fix on this one? thanks ...

filter birthday's by month in Excel
I have tried the above by auto filtering, then custom filter, however when i type for example ??/07/?? or **/07/** nothing works. Could you please tell me how to filter birthday's by month as soon as possible. Kind regards, Lisa Peterson I don't know a way to do it directly. As a work-around, you could add a column and fill it down with the formula (assuming the dates are in ColA, starting at A2) =month(A2). Then filter the database based on the new column. Rgds, ScottO "Lisa Peterson" <Lisa Peterson@discussions.microsoft.com> wrote in message news:4C9E7EAE-9FD...

Send button --WEBBOT SELF--
I wrote the earlier question and then kept looking for answers. I found the following at MSMVPS.com After the form is submitted the page is redirected to a confirmation page. You cannot change that function nor change the confirmation page. That is not available in Publisher. If this is true then how am I going to get my form page to work. Please help me!!! reference: Publisher web publication forms 101: http://msmvps.com/blogs/dbartosik/archive/2006/01/07/80564.aspx Reference: How to publish a Publisher web in HTTP: http://msmvps.com/blogs/dbartosik/pages/80557.aspx Applicable if yo...

Query emails coming to a specific domain
Hello; We have about 5 domains on our exchange server that we receive email from. We are in the process of not renewing one of our domains but would like to check to see if email from that domain is still coming through. Is there any way to do that? I tried the Message Tracking Center with the *.domain.com but it didn't like that. It wanted a specific user. Thanks Check SMTP logs as well. -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: www.exchangepedia.com/blog ---------------------------------------------- <nospam@newsgroup.com> wrote in message news:...

Determine Which Button was Right-Clicked?
All, I am using the code below (started from a sample from one of these groups) to programmatically create a series of buttons in a vertical strip on a form on Form Open. I have a context menu which appears when the user right-clicks any button on the form. How do I "tell" the context menu (really a function on the context menu) which button was right-clicked? I know how to get button attributes when the user left-clicks...but that's not what I need... Is there a way to do this? Thanks, Patrick Code::: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ...

xp desktop and start button missin
cant get into to windows even in safe mode have to go to task manager to open anytgin In task mgr,locate "new task",type: cmd In cmd type: CHKDSK C: After,you may want to type: Sfc /Scannow Install xp cd,exit the menu page.Once its thru,remove xp cd,type: CHKDSK C: /F Agree to restart,type: EXIT Restart pc. "jen" wrote: > cant get into to windows even in safe mode have to go to task manager to open > anytgin ...

Stop Buttons showing when opening up form
I have a button on my Main Start up page that when click makes these buttons visible, but when I open up my DB they automatically show on start up, is it possible they not be visible till I click ckbHelp.......Thanks for any Help.....Bob Private Sub ckbHelp_Click() If ckbHelp = True Then cmbHelpNewHorse.Visible = True cmbHelpActFinHorse.Visible = True End If If ckbHelp = False Then cmbHelpNewHorse.Visible = False cmbHelpActFinHorse.Visible = False End If End Sub Bob, In design view, set the property pf the *button* Visible=No Regards/Jacob "Bob" <xxx@xx.xx> wrote i...

How do I filter rows based upon a column value
I have a spreadsheet that contains multiple agency id's in a column. When generating reports, I would like to filter per agency and display only the rows associated with that agency. Is there a tutorial or sample on how to do this? Hi It sounds like you are looking for Data / Filter / AutoFilter. Have a look here for some basics: http://www.contextures.com/xlautofilter01.html -- Andy. "Jack" <nfr@nospam.com> wrote in message news:eqiU08TVEHA.2988@TK2MSFTNGP10.phx.gbl... > I have a spreadsheet that contains multiple agency id's in a column. When > generati...

How to change caption on 'apply' button in a CPropertySheet-derived class?
Hi, Does anyone know how to change the caption on the 'apply' button in a CPropertySheet-derived class? I derived a class CPlotSettingsDialog1. Here is it's OnCreate. int CPlotSettingsDialog1::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CPropertySheet::OnCreate(lpCreateStruct) == -1) return -1; CRect WindowRect; GetWindowRect(&WindowRect); WindowRect.bottom = WindowRect.bottom + 60; MoveWindow(&WindowRect); return 0; } all the code does is make the bottom of the property sheet a bit longer. It still has the 3 default buttons. I need to either re-caption t...

OUTLOOK Attachment Filter
How do I modify, turn-off, or override the stupid Outlook attachment filter? If I want attachments to be blocked, I want to have the choice, not this program from Microsoft. I've already lost one important attachment. How do I get around it, or kill it outright? JWeinberg The PCMagazine site has a tip that deals with this. It requires you to edit the Registry. (www.pcmag.com/tips/) is the site. Outlook 2002 keeps you from opening attachmentw with extension like .exe or .bat because of the potential for viruses. If you are comfortable editing the system Registry, you can tell...

Mail Button on ie8
I just started using ie8 and was using hot mail I found out I could use live instead of live hot mail. My question is when I click the mail button it stills shows up hot mail.I set live as my default email but it didn't make any difference On Tue, 15 Dec 2009 13:59:03 -0800, kln wrote: > I just started using ie8 and was using hot mail I found out I could use live ... "Live" what? > ... instead of live hot mail. There are: Windows Live Mail (a desktop client, akin to MS Outlook Express. Windows Live Hotmail (an online email service, accessible by ...

query to make a list of products based on delivery history
I have a table which lists all deliveries made of our product. From this table, I'd like to make a list of all products. My problem is the products will have many duplicates as they can be ordered multiple times and I just want a list showing all the individual products that we offer. -- TIA Try something like: SELECT DISTINCT [our product] FROM [which list all deliveries made]; If you can't figure this out, come back with table and field names. -- Duane Hookom Microsoft Access MVP If I have helped you, please help me by donating to UCP http://www.access.hookom.net/UCP/Def...

Junk E-Mail Filter Rules
(I posted this on an old thread but not sure anyone looks back through those, so...) If I block all e-mails from a domain using "@theirdomain.com" that works fine, EXCEPT when the e-mail address looks like "Fred Bloggs [fbloggs123@theirdomain.com]" and then it seems to get passed over and left in the Inbox. Should I be blocking something else? TIA, JohnK Use a rule with specific words in the email address and make that word theirdomain. -- Bill R MVP "John F Kappler" <john@pceffect.co.uk> wrote in message news:nrtta3l3nlpdc0ngvov1jcifjva0cc9igf@4ax....

Update Query based on Current Recordset
I have a continuous form with filtered records. I want to run an update query on a field in a table based on the current filtered records on the form. What code would I use to accomplish this task? Any help appreciated in getting me started. NEWER USER, Without a wee bit more information, like what are you trying to update, field names, table names, do you want this attached to a button or an event, etc... The best I can do is... UPDATE SomeTable SET SomeTable.SomeField= WhateverValue WHERE (((SomeTable.SomeOtherFied)=WhateverValue)); Of course, the above would be an ...

IIF Query for Numeric Values in Text Field
I’m attempting to flag interest rate spread errors and omissions in a file from a sales database using IIF statements I adapted from another database (I’m a novice at this). The field I’m querying is text format and contains both alpha and numeric values. When I test for a null value the IIF works fine, but when I test for a numeric value I get an #ERROR. Spread Error1: IIf(([Tbl 1 Eligible Closed Deposit Opps Appended]!Spread Is Null),1,0) Spread Error2: IIf(([CCC Fall 2007 Eligible Products]![IB/NIB]="NIB" And [Tbl 1 Eligible Closed Deposit Opps Appended]!Spread<4),1,0...

How To apply security roles to ISV buttons/menus
Hi all, Can anyone tell me if it's possible to apply the CRM security roles on the ISV-defined buttons and menus. Because all I've found is to enable or disable ISV for a security role. But what if I want to enable only 2 buttons for role1 and 1button an a menu for role2 ? I've searched throught the ISV definition (msdn) but it seems that you can't define security in the ISV.config So where can it be done ? Thanks a lot DA ------=_NextPart_0001_4105D61B Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi DA, Thanks for your post. Unfortunately, there is no way t...

How to setup ACM filter driver to work?
Hi, I=92m building ACM filter driver using Windows Embedded CE 6.0 (installed with Visual Studio 2005). The driver should be loaded automatically by the operating system and process audio stream for any running application such as MediaPlayer etc. The problem is that the driver is not loaded automatically as expected. Please note the following information: - I'm testing it with a regular phone with WindowsMobile 6.0. Although I have PB installed I'm not building a full image and I don't have a physical board for it. - My driver was originated from the msfilter...

Help with Lists (tables), Filters, & Worksheets
I'm hoping that I'm just missing something and somebody out there can help me. I'm using Excel 2007, but I'm trying to do something that would also be backwardly compatible. I've used the table (list) function to create a list of campers & associated data for my son's summer camp. What we want to do is have tabbed worksheets within the workbook that shows that data in different views. So, for instance, the first tab is the master list, but the second tab is filtered for the kids in the 1st session youngest class, the third tab is filtered for the kids in the...

OWA password button opens email
Hello, Exchange 2003 sp2, server 2003. In OWA when users click on change password, a 404 error appaears, then redirects and opens another window of OWA. Any idea's? TIA, Eric Hi, You have followed this ( http://support.microsoft.com/kb/297121/en-us ) to enable the change password feature? Leif "Eric K" <EricK@discussions.microsoft.com> wrote in message news:1EAE5451-4DCB-4D17-A6BA-AAEB02824644@microsoft.com... > Hello, > Exchange 2003 sp2, server 2003. In OWA when users click on change > password, > a 404 error appaears, then redirects and opens another...

Insert query with two left outer joins gives "Record is Deleted" m
Hi, I have built an insert query to combine data from 3 tables into one table based on a key value (RA_ID) on a form. Two of the from tables may or may not have data associated with the main from table. So I have coded the select from statement using left outer joins. When I run the query with a row in the first child table but not in the second it works fine but when I run the query with a key value that exists in the 2nd child table but not in the first I get a message saying "record is deleted". Anybody have any ideas what is causing this? Here is the query......... ...

Filter by multiple colors
In Excel 2007, I am trying to filter by two different colors. I can see how I can filter by just one color - can I filter by two colors? Thanks for your help, -- Michelle ...

Out of Office and Junk Filtering
Will an out of office message go out to senders who send me junk? If the junk filtering recognizes it as junk, I don't want to validate the address by sending them a message. I'd like to think it only goes out to messages that make it to the inbox, is this correct? Where might I find some documentation on this issue? Thank you, Andy Siegel City of Dover Dover, DE OOO is an exchange feature, where the junk filtering takes places on your machine. In other words, the filter only fires after OOO did its work already and the filter comes too late. Although my OOO is usually on, ...

Button to reset form values
Hi, I have entered some coding so that when my spreadsheet open, all user values are set to zero (default values). How do I add a button to my worksheet for the user to click on to reset the values to there defaults while working on that sheet :) -- propolis ------------------------------------------------------------------------ propolis's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=5044 View this thread: http://www.excelforum.com/showthread.php?threadid=506012 I'd create a named range and then just clear the cells in that named range. Select your...