473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Filtering on a subform

I have your typically form/subform. You enter the account number in a
textbox and select whether you want to see the detail or summary
information on the main form. Both fields I want to filter on are
text. Here is a sample of the code I am using.

The filtering works fine when I do them independently (see below)
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = "[EKCNBR]
=" & Me![bxAcctNbr]

Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter =
"[BREAKLVL] =" & "'" & 2 & "'"

When I combine them, I receive the error message "You canceled the
previous operation" when it hits the filterOn = true line.
strfilter = "[EKCNBR] = """ & Me![bxAcctNbr] & """" & " And " &
"[BREAKLVL] = "" & 2 & """
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

Can anyone figure this out? Thanks for any help you can provide
Nov 12 '05 #1
4 8953
strfilter = "([EKCNBR] = """ & Me![bxAcctNbr] & """) And ([BREAKLVL] =
""2"")"
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Doug" <do********@cox .com> wrote in message
news:1e******** *************** ***@posting.goo gle.com...
I have your typically form/subform. You enter the account number in a
textbox and select whether you want to see the detail or summary
information on the main form. Both fields I want to filter on are
text. Here is a sample of the code I am using.

The filtering works fine when I do them independently (see below)
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = "[EKCNBR]
=" & Me![bxAcctNbr]

Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter =
"[BREAKLVL] =" & "'" & 2 & "'"

When I combine them, I receive the error message "You canceled the
previous operation" when it hits the filterOn = true line.
strfilter = "[EKCNBR] = """ & Me![bxAcctNbr] & """" & " And " &
"[BREAKLVL] = "" & 2 & """
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

Can anyone figure this out? Thanks for any help you can provide

Nov 12 '05 #2
I am still getting the error message "You canceled the previous
operation". Is there another way to process this request?

Thanks for your help

"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message news:<40******* *************** *@freenews.iine t.net.au>...
strfilter = "([EKCNBR] = """ & Me![bxAcctNbr] & """) And ([BREAKLVL] =
""2"")"
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Doug" <do********@cox .com> wrote in message
news:1e******** *************** ***@posting.goo gle.com...
I have your typically form/subform. You enter the account number in a
textbox and select whether you want to see the detail or summary
information on the main form. Both fields I want to filter on are
text. Here is a sample of the code I am using.

The filtering works fine when I do them independently (see below)
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = "[EKCNBR]
=" & Me![bxAcctNbr]

Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter =
"[BREAKLVL] =" & "'" & 2 & "'"

When I combine them, I receive the error message "You canceled the
previous operation" when it hits the filterOn = true line.
strfilter = "[EKCNBR] = """ & Me![bxAcctNbr] & """" & " And " &
"[BREAKLVL] = "" & 2 & """
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

Can anyone figure this out? Thanks for any help you can provide

Nov 12 '05 #3
The message indicates that there is something wrong with the filter string.
Perhaps there is a spelling mistake, or perhaps the delimiters are wrong.

For example, if CKCNBR is a Number type field (not a Text type field), drop
the extra quotes:
strfilter = "([EKCNBR] = " & Me![bxAcctNbr] & ") And ...

One way to see how this should look would be to make a query into this
table. Put any old number as an example under the 2 fields. Then switch to
SQL view (View menu), and see what the WHERE clause looks like. At least you
know what strfilter should end up like.

Now add this to your code:
Debug.Print strFilter
After it messes up, open the Immediate Window (Ctl+G) and compare what it
wrote to what you saw in the query.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Doug" <do********@cox .com> wrote in message
news:1e******** *************** ***@posting.goo gle.com...
I am still getting the error message "You canceled the previous
operation". Is there another way to process this request?

Thanks for your help

"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message

news:<40******* *************** *@freenews.iine t.net.au>...
strfilter = "([EKCNBR] = """ & Me![bxAcctNbr] & """) And ([BREAKLVL] =
""2"")"
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

"Doug" <do********@cox .com> wrote in message
news:1e******** *************** ***@posting.goo gle.com...
I have your typically form/subform. You enter the account number in a
textbox and select whether you want to see the detail or summary
information on the main form. Both fields I want to filter on are
text. Here is a sample of the code I am using.

The filtering works fine when I do them independently (see below)
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = "[EKCNBR]
=" & Me![bxAcctNbr]

Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter =
"[BREAKLVL] =" & "'" & 2 & "'"

When I combine them, I receive the error message "You canceled the
previous operation" when it hits the filterOn = true line.
strfilter = "[EKCNBR] = """ & Me![bxAcctNbr] & """" & " And " &
"[BREAKLVL] = "" & 2 & """
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.Filter = strfilter
Forms![frmPaymentSearc h].[sbfrmPaymentSea rch].Form.FilterOn = True

Can anyone figure this out? Thanks for any help you can provide

Nov 12 '05 #4
The did the trick!!!
strfilter = "([EKCNBR] = " & Me![bxAcctNbr] & ") And ([BREAKLVL]
=""2"")". The field EKCNBR contains numbers but based on the field data
type it shows it as a text. I only assumed I should be looking for text
rather than a number. The table is a linked table from the AS400 that I
did not create. Thank you so very much!!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11109
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I have a primary form named TestResults, which is connected to data in a table named TestResults. There are basically two other tables that are related to the TestResults table (and the primary form) named Names-Normalized and SiteAddresses. The...
3
18235
by: arthur-e | last post by:
I can filter a query for a report on a field of a subform BUT now.... I'd like to be able to select more than one item in a multi-list box to select all the records. ALSO to use two fields (or more) fields to filter a query based on selections in two or more fields: All the records with NAME = all the names selected in a list box BETWEEN StartDate and EndDate
19
3576
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
4
499
by: Doug | last post by:
I have your typically form/subform. You enter the account number in a textbox and select whether you want to see the detail or summary information on the main form. Both fields I want to filter on are text. Here is a sample of the code I am using. The filtering works fine when I do them independently (see below) Forms!..Form.Filter = " =" & Me! Forms!..Form.Filter =
3
2616
by: Todd | last post by:
Hi, I've been told in another forum that I can apply a filter to a subform (from a control on the main form) by using the following code: Me.sfrMySubform.Filter = " = 7" I've tried this solution but it isn't working for me. Here's my code: Private Sub fraShowRows_Click()
2
1612
by: Katie | last post by:
I need to store a history of two fields in two seperate tables: Event - where the key is Event_ID Stage - where the key is Stage_ID The joins are: Main Table Event Table Stage Table My screen has:
3
5390
by: paquer | last post by:
On my Main form I have a Command Button that opens a Subform in order to create a new Subform record. At this point I want the subform to show only the new record being created. Not all the records the subform's table has. I cannot put the subform as Data Entry because I cannot print the main form & subform together if the subform is "data entry". (comes up blank every time)
1
6804
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes bits of code for different examples. I have one last thing to finish. I am trying to create a search form that will allow users to select criteria from multiple sources eg ,multi select list boxes , combo boxes. I have a subform showing all the...
64
6824
by: lovelydan | last post by:
hi all i need someone to help me with a code that will enable me filter records in a subform form through a combo box attached to a mainform-that has a main menu that controls all the sub form that runs under sourceObject on the mainform unbound frame. like, when i a company name on mainform combo box then the subform shows only records for that company. eg like how it works when filtering a query.. regards. lovelydan P.S. subforms...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.