Filtering by combo does not work

Hello experts:

Here is the data property of my combo box:

Control Source: SupName
Row source Type: Table/Query
Rouw Source: SELECT Suppliers.SupName FROM Suppliers; 
Bound Column: 1

Here is my event property on Click:
Private Sub SupName_Click()
         Filter = "[SupName]"
         FilterOn = True

The above does not work on my filtering by combo box.

This is to filter by supplier in my main form. I plan not to use filtering 
by form on the tool bar, because I plan to have the next filter in my subform 
using similar to Northwind of access of "Customer Phone List" which is using 
Macro Phone list,

Thanks in advance for any help provided.

Frank



0
Utf
8/22/2007 4:14:01 AM
access.formscoding 7493 articles. 0 followers. Follow

6 Replies
690 Views

Similar Articles

[PageSpeed] 10

The string value that you give to the filter must include the field name and 
the value for that field name. Assuming that SupName is the name of the 
field, and the name of the combo box:

Filter = "SupName=" & Me!SupName.Value

The above is used if the combo box's bound column contains a numeric value. 
If it's a text value:

Filter = "SupName='" & Me!SupName.Value & "'"


You probably are going to have a problem with this form for another reason. 
It appears that you are naming the combo box the same as the SupName field, 
and you have the combo box bound to the SupName field. This means that the 
value of the SupName field for the current record is going to be changed to 
the value you select in the combo box, and then the form's filter "may" 
work. However, the form is going to have a problem telling the difference 
between the field named SupName and the combo box named SupName. If you want 
to use the combo box just for setting a filter, its Control Source should be 
empty (unbound), and you should name the combo box something like 
cboSupName, or cboSupNameFilter.

Also, rather than use the Click event of the combo box, use the AfterUpdate 
event of the combo box to set the filter for the form.

-- 

        Ken Snell
<MS ACCESS MVP>



"Frank Situmorang" <frank.situmorang@kinden.co.id> wrote in message 
news:743ACA82-723C-4887-AE9C-085609AB8893@microsoft.com...
> Hello experts:
>
> Here is the data property of my combo box:
>
> Control Source: SupName
> Row source Type: Table/Query
> Rouw Source: SELECT Suppliers.SupName FROM Suppliers;
> Bound Column: 1
>
> Here is my event property on Click:
> Private Sub SupName_Click()
>         Filter = "[SupName]"
>         FilterOn = True
>
> The above does not work on my filtering by combo box.
>
> This is to filter by supplier in my main form. I plan not to use filtering
> by form on the tool bar, because I plan to have the next filter in my 
> subform
> using similar to Northwind of access of "Customer Phone List" which is 
> using
> Macro Phone list,
>
> Thanks in advance for any help provided.
>
> Frank
>
>
> 


0
Ken
8/22/2007 4:23:49 AM
Hi Frank,

Take a look at this link from Allen Browne  

http://allenbrowne.com/ser-28.html

Use the afterupdate event of the combo box, don't use the on click event.

>Frank Situmorang wrote:
>Hello experts:
>
>Here is the data property of my combo box:
>
>Control Source: SupName
>Row source Type: Table/Query
>Rouw Source: SELECT Suppliers.SupName FROM Suppliers; 
>Bound Column: 1
>
>Here is my event property on Click:
>Private Sub SupName_Click()
>         Filter = "[SupName]"
>         FilterOn = True
>
>The above does not work on my filtering by combo box.
>
>This is to filter by supplier in my main form. I plan not to use filtering 
>by form on the tool bar, because I plan to have the next filter in my subform 
>using similar to Northwind of access of "Customer Phone List" which is using 
>Macro Phone list,
>
>Thanks in advance for any help provided.
>
>Frank

-- 
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

0
AccessVandal
8/22/2007 4:34:20 AM
Ken,

I have followed your instruction but it seems has not worked. This is my VBA:
Private Sub CboSupName_AfterUpdate()
    Filter = "CboSupName='" & Me!SupName.Value & "'"
    FilterOn = True
End Sub

For your info, this form with the subform perfeclty works using filter by 
form on the tool bar.

Could you please help me?

Frank

"Ken Snell (MVP)" wrote:

> The string value that you give to the filter must include the field name and 
> the value for that field name. Assuming that SupName is the name of the 
> field, and the name of the combo box:
> 
> Filter = "SupName=" & Me!SupName.Value
> 
> The above is used if the combo box's bound column contains a numeric value. 
> If it's a text value:
> 
> Filter = "SupName='" & Me!SupName.Value & "'"
> 
> 
> You probably are going to have a problem with this form for another reason. 
> It appears that you are naming the combo box the same as the SupName field, 
> and you have the combo box bound to the SupName field. This means that the 
> value of the SupName field for the current record is going to be changed to 
> the value you select in the combo box, and then the form's filter "may" 
> work. However, the form is going to have a problem telling the difference 
> between the field named SupName and the combo box named SupName. If you want 
> to use the combo box just for setting a filter, its Control Source should be 
> empty (unbound), and you should name the combo box something like 
> cboSupName, or cboSupNameFilter.
> 
> Also, rather than use the Click event of the combo box, use the AfterUpdate 
> event of the combo box to set the filter for the form.
> 
> -- 
> 
>         Ken Snell
> <MS ACCESS MVP>
> 
> 
> 
> "Frank Situmorang" <frank.situmorang@kinden.co.id> wrote in message 
> news:743ACA82-723C-4887-AE9C-085609AB8893@microsoft.com...
> > Hello experts:
> >
> > Here is the data property of my combo box:
> >
> > Control Source: SupName
> > Row source Type: Table/Query
> > Rouw Source: SELECT Suppliers.SupName FROM Suppliers;
> > Bound Column: 1
> >
> > Here is my event property on Click:
> > Private Sub SupName_Click()
> >         Filter = "[SupName]"
> >         FilterOn = True
> >
> > The above does not work on my filtering by combo box.
> >
> > This is to filter by supplier in my main form. I plan not to use filtering
> > by form on the tool bar, because I plan to have the next filter in my 
> > subform
> > using similar to Northwind of access of "Customer Phone List" which is 
> > using
> > Macro Phone list,
> >
> > Thanks in advance for any help provided.
> >
> > Frank
> >
> >
> > 
> 
> 
> 
0
Utf
8/22/2007 7:02:01 AM
Hi... Accerss Vandal...I have read the website you provided, but do you think 
we need the innerjoin?, because  we already have the link in my table, which 
the invoice table is the parent while supplier table is child, so I can see 
the invoices details for selected supplier in the filtering by combo.

My concern now is to make combo fiterling supplier in the mainform (without 
using filtering by form of toolbar) and afterthat I want to filter the 
subform to showup only the outstanding inovicess the 2nd one is Paid invoices 
and the default is show all using toggle buttons in the option group of 
subform header. I need these features because I use continous form, other 
wise it will be very2 long downward browsing.

Frank

Appreciate  your help

"AccessVandal via AccessMonster.com" wrote:

> Hi Frank,
> 
> Take a look at this link from Allen Browne  
> 
> http://allenbrowne.com/ser-28.html
> 
> Use the afterupdate event of the combo box, don't use the on click event.
> 
> >Frank Situmorang wrote:
> >Hello experts:
> >
> >Here is the data property of my combo box:
> >
> >Control Source: SupName
> >Row source Type: Table/Query
> >Rouw Source: SELECT Suppliers.SupName FROM Suppliers; 
> >Bound Column: 1
> >
> >Here is my event property on Click:
> >Private Sub SupName_Click()
> >         Filter = "[SupName]"
> >         FilterOn = True
> >
> >The above does not work on my filtering by combo box.
> >
> >This is to filter by supplier in my main form. I plan not to use filtering 
> >by form on the tool bar, because I plan to have the next filter in my subform 
> >using similar to Northwind of access of "Customer Phone List" which is using 
> >Macro Phone list,
> >
> >Thanks in advance for any help provided.
> >
> >Frank
> 
> -- 
> Please Rate the posting if helps you
> 
> Message posted via http://www.accessmonster.com
> 
> 
0
Utf
8/22/2007 8:22:02 AM
Hi Frank,

Try to change the field name from

Filter = "CboSupName='" & Me!SupName.Value & "'"

To

Filter = "SupName='" & Me!CboSupName.Value & "'"

"SupName" was the field name of the Record source and "CboSupName" is the
form's control name.
Have I got it right?

>Frank Situmorang wrote:
>Hi... Accerss Vandal...I have read the website you provided, but do you think 
>we need the innerjoin?, because  we already have the link in my table, which 
>the invoice table is the parent while supplier table is child, so I can see 
>the invoices details for selected supplier in the filtering by combo.
>
>My concern now is to make combo fiterling supplier in the mainform (without 
>using filtering by form of toolbar) and afterthat I want to filter the 
>subform to showup only the outstanding inovicess the 2nd one is Paid invoices 
>and the default is show all using toggle buttons in the option group of 
>subform header. I need these features because I use continous form, other 
>wise it will be very2 long downward browsing.
>
>Frank
>
>Appreciate  your help
>
>> Hi Frank,
>> 
>[quoted text clipped - 29 lines]
>> >
>> >Frank

-- 
Please Rate the posting if helps you

Message posted via http://www.accessmonster.com

0
AccessVandal
8/22/2007 10:22:36 AM
You've reversed the field and combo box names in the filter string:

Private Sub CboSupName_AfterUpdate()
    Filter = "SupName='" & Me!CboSupName.Value & "'"
    FilterOn = True
End Sub


-- 

        Ken Snell
<MS ACCESS MVP>


"Frank Situmorang" <frank.situmorang@kinden.co.id> wrote in message 
news:FED01547-2FFC-490E-9ACD-09D678017EA1@microsoft.com...
> Ken,
>
> I have followed your instruction but it seems has not worked. This is my 
> VBA:
> Private Sub CboSupName_AfterUpdate()
>    Filter = "CboSupName='" & Me!SupName.Value & "'"
>    FilterOn = True
> End Sub
>
> For your info, this form with the subform perfeclty works using filter by
> form on the tool bar.
>
> Could you please help me?
>
> Frank
>
> "Ken Snell (MVP)" wrote:
>
>> The string value that you give to the filter must include the field name 
>> and
>> the value for that field name. Assuming that SupName is the name of the
>> field, and the name of the combo box:
>>
>> Filter = "SupName=" & Me!SupName.Value
>>
>> The above is used if the combo box's bound column contains a numeric 
>> value.
>> If it's a text value:
>>
>> Filter = "SupName='" & Me!SupName.Value & "'"
>>
>>
>> You probably are going to have a problem with this form for another 
>> reason.
>> It appears that you are naming the combo box the same as the SupName 
>> field,
>> and you have the combo box bound to the SupName field. This means that 
>> the
>> value of the SupName field for the current record is going to be changed 
>> to
>> the value you select in the combo box, and then the form's filter "may"
>> work. However, the form is going to have a problem telling the difference
>> between the field named SupName and the combo box named SupName. If you 
>> want
>> to use the combo box just for setting a filter, its Control Source should 
>> be
>> empty (unbound), and you should name the combo box something like
>> cboSupName, or cboSupNameFilter.
>>
>> Also, rather than use the Click event of the combo box, use the 
>> AfterUpdate
>> event of the combo box to set the filter for the form.
>>
>> -- 
>>
>>         Ken Snell
>> <MS ACCESS MVP>
>>
>>
>>
>> "Frank Situmorang" <frank.situmorang@kinden.co.id> wrote in message
>> news:743ACA82-723C-4887-AE9C-085609AB8893@microsoft.com...
>> > Hello experts:
>> >
>> > Here is the data property of my combo box:
>> >
>> > Control Source: SupName
>> > Row source Type: Table/Query
>> > Rouw Source: SELECT Suppliers.SupName FROM Suppliers;
>> > Bound Column: 1
>> >
>> > Here is my event property on Click:
>> > Private Sub SupName_Click()
>> >         Filter = "[SupName]"
>> >         FilterOn = True
>> >
>> > The above does not work on my filtering by combo box.
>> >
>> > This is to filter by supplier in my main form. I plan not to use 
>> > filtering
>> > by form on the tool bar, because I plan to have the next filter in my
>> > subform
>> > using similar to Northwind of access of "Customer Phone List" which is
>> > using
>> > Macro Phone list,
>> >
>> > Thanks in advance for any help provided.
>> >
>> > Frank
>> >
>> >
>> >
>>
>>
>> 


0
Ken
8/22/2007 12:42:58 PM
Reply:

Similar Artilces:

Bill Calendar and Debt Planner? How do they work together?
Ok I have read all I could find but I can't seem to find anything that explains how the debt planner and bill calendar work together. For the explanation of what I am doing I will talk of only one bill. I entered my Providian credit card in the bill calendar. It is also in the debt planner that has me paying a different amount so I will hit the pay off debt date. I don't pay my bills through money because my bank doesn't allow that just downloading of the statements. I am hoping when I pay the Providian credit card from my banks website and download the statements to money that...

Filters *SOS* Filters *SOS* Filters *SOS*
1) On formLoad, I need to show only those items which are unassigned. 2) I need for the end-under to select only the items they are assigned to. 3) I need an option to select "ALL" so I can view all items. Any insight offered would be appreciated!!! On Wed, 29 Aug 2007 16:24:01 -0700, valdaiway <valdaiway@discussions.microsoft.com> wrote: >1) On formLoad, I need to show only those items which are unassigned. Use a query to put a criterion on the field that defines the assigned status. I assume you know how that information is stored in your table; nobody here does, ...

Criteria for Advanced Filter HELP
I have what I think is a simple question that I need answered IMMEDIATELY. I have a spreadsheet with 20 fields and I want to filter it so it only shows records that have something in of any of 5 of those fields. So once filtered, I will not have any records that have all 5 of those fields blank. I know I have done this before but I'll be damned if I can remember or find out how. -- Thanks You all are teaching me so much don't cross-post -- answer supplied in misc NG "knowshowrosegrows" <knowshowrosegrows@discussions.microsoft.com> wrote in message news:ACBC0...

Employee Filters
Hello: On the employee filters in the HR Preferenes window, would this restrict seeing employee information in both Payroll and HR? Also, would it restrict reporting on certain employees in a division or department? Thanks! childofthe1980s Your message does not indicate which version of Great Plains you are using. Using 8.0 with SP3 applied, HR filters do apply to some of employee information outside of HR. The settings will filter selected forms, Smartlists and Lists items. The HR filter setting do not apply to reports outside of HR. The filtered forms are: Employee Maintenance,...

MS Money Sync Finally Working for Me #2
My MS Money Sync and one of my credit card accounts has not synchronized in over a month. I finally have it working now after trying a solution that Hans reported he had picked up from an Microsoft rep. This is what I did: 1) Disabled my credit card account in MS Money that would not syncrhonize (Manage Online Services, choose the account, click on Stop Using Online Servcies) If I tried to re-set it up in MS Money, I received the "Account Setup Unavailable Message". 2)Went to MSN Money Central on the web. Clicked on My Accounts. Entered passport ID. Went to bottom of page and cli...

Search feature not working or is it?
Outlook2003/XP User is doing a search but the search is bringing up the earliest items first and not the latest. (February 2005 before April 2005). It will eventually populate the latest..eventually. I believe the direction it is searching is opposite of what it should be searching. Any ideas? Thank you. It has always been this way - searching for the older item first as people are most likely to forget something seen last year as opposed to yesterday. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus n...

Filtering based on a filter
Hello, I have an Excel Worksheet with a Pivot Table at the top with a Filter and a data set returned from a DB2 database below it. I would like to filter the DB2 data set based on the Pivot Table filter that is enabled. Any ideas? Thanks! James, You can't filter two ranges on the same worksheet. You can, instead, drill-down on your pivot table, which will show all items that go into the value on a newly created separate sheet. The drawback to that is that you cna only drill down on one item at a time, and it is a separate sheet. HTH, Bernie MS Excel MVP "James" <an...

Question on the IMF filtering in exchange...
Hey I installed the IMF filter last night and it works great, with one exception. I set both thresholds to the same (5) and got almost all blocked emails into the archive that were junk...So that is good. However I had some users report that there was mail in their junk folder that should have been good Inbox mail. This I undersyand and can live with as folas-positives...the problem is, since both settings on the folter tab were set to 5, how does it know to send the mail to archive rather than Junk folder? Why wouldn't it just send them all to archive if both settings were at ...

Filtering without Filter
I just don't get the following. Any ideas? "A" row I have two different values I use: "Contact" and "Not a contact". "B" row I have the person's name (employee). "C" row I have a quantity, just one number. Now what I need is to output quantities of how many Contacts Employee1 or Employee2 or Employee3 have. Also what I need is to get the number of contacts - which can be found on row "C". Should I use COUNT.IF ? Row A can have 2 or more different values so should there be somekind of conditional IF function included? T...

Filtering #11
Hi, can ayone tell me how I could do the following in excel 2007 or 2010: Horse Trainer Sam M Jones John M Jones Colin S Attwater Steve J Jackson Brian B Mathers James B Mathers Martin G Raggy Patrick S Thomson What I want to do is filter the dataset on 'Trainer' so that it only shows me the Trainers who feature once in the list. So if I was to do this properly it would only show S Attwater and G Raggy as the other trainers have more than one horse..... Hopefully someone can help because it is driving me crazy !! Thanks David Give this macro a try... Sub HideDuplicateTr...

RPC over Https problem still can't work
I AM USING Single Server + DC I FOLLOW THIS http://www.amset.info/exchange/rpc-http-server.asp AND USING selfsll DOING HTTPS When i test and type https://domainname/rpc It will be prompted for credentials three times after which the following error is displayed, HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource. And using outlook can't connect to Exchange What can i do ,How can i solove the problem Best Regards Try this link for general troubleshooting help http://support.microsoft.com/kb/827330 "snakesboy" <snakes...

Junk filter BEFORE other filters?
I am running Outlook 2003 and the Junk filter was working really well. Then I started making other filters...one of them looks for my domain name in the headers and if it's there it moves the email to a folder. Problem is, this filter seems to activate before the junk filter, so the junk sn't being filtered now! How can I set the junk filter to do it's job first and THEN to run my own rules? -- Bryan Anderson <www.anderson-it.com> I created this rule and set it as the first rule to run: Apply this rule after the message arrives with 'X-Spam-Level:******'or'...

Macro to copy a VLOOKUP formula
Hello, I was wondering if somebody could help me with this macro… I have some data with a filter on, so that only the rows with blank cells are showing. I want to enter a VLOOKUP in the cell, and copy it down to all the blank cells. I tried just recording a macro, but when I run the macro it doesn’t work. Any ideas of how to do it? Example: 1) Before the filter: Colums A -B - C A x x - 1st Row A - 2nd Row A x x - 3rd Row A - 4th row A x x - 5th row 2) After the fil...

Going from one combo to another
I have a worksheet with some combo boxes. I want to hit the tab key and move from one combo to the next one. Is that possible? How is it done? -- bernardoafs ------------------------------------------------------------------------ bernardoafs's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28993 View this thread: http://www.excelforum.com/showthread.php?threadid=489382 Hi, if you open goto your userform properties, there is an area called Tab Index. alter the numbers to your tab preference as they are automatically set by the point you added your combo b...

I need to work with CListView
I try to use the CListView deried class to display the customer details in SDI . I cant insert the details can any one help. I am new to MFC. So please help me. Thanks in advance. regards, KSMH On Feb 15, 2:21 am, "mohamed hanif" <mohamedhani...@gmail.com> wrote: > I try to use the CListView deried class to display the customer > details in SDI . > > I cant insert the details can any one help. I am new to MFC. So please > help me. > > Thanks in advance. > > regards, > KSMH Whats the problem? What happens when you insert/add? Look at codeguru/...

Pasting into a filtered list
Can anyone tell me if it is possible to paste a list of price updates into a filtered list. - I have filtered the list to show just the products whose prices need to be updated, when I try to paste the updated prices, into the list, the prices are not just pasted into the visible cells but the hidden cells between. Can I paste into the visible cells only or do I have to update each line manually. I am using Excel 2002 Any help would be much appreciated Can you sort the list to bring the products that need updating together in the list? If not, try something like this: Your list of product...

apply filter macro
I have a access db that works on win xp but does not work on win 2007 I have a combo box that triggers a apply filter macro using a query sort. no problem on win 2000 or win xp or win 2003 Help AlT ...

SBS 2003 and CRM Reporting Not working
I know, generic thread title, but here's the deal... I am able to browse to servername/reports and view and work with the CRM Reports. I'm also able to access servername/reportserver. Inside CRM I get an error dialog box when I try to go to those reports. I followed the steps on Larry's Taco Talk (thanks Larry), but am stuck on making sure the proper permissions are set on the reports. Everyone else seems to have had to add the NT Authority\Network Service and publisher role to get theirs to work. I did add that, but my DomainName\ReportingGroup doesn't exist in the...

IP filtering based on corresponding MX records
Hello Dears, How can I implement the following? Used: Exchange 2003 SP2 in FE/BE configuration; FE is in perimeter zone (capable to “speak” with DNS, BE, DCs and retrieve info) So, somebody connects my FE to sent an e-mail to one of domain users. I need something like that: When connecting, see the “mail from: user@somedomain.xxx”; Verify if there is a record MX for the IP address from which the connection was established in DNS for the domain “somedomain.xxx” If not – drop connection (attention: MX record, not SPF) Is it possible with Exchange 2003 SP2 only? How? Thank you, Alex I be...

Month Filter
I keep a log of checks that I receive in my department throughout the year. I have the checks listed by date (mm/dd/yy), payee, check #, etc. What I want to do is be able to filter the list by month (ex., March 2005). Is there a way to do this? Thanks Joseph You can Try EasyFilter Joseph http://www.rondebruin.nl/easyfilter.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Joseph" <joe@nospam.com> wrote in message news:%23lQNnTawFHA.464@TK2MSFTNGP15.phx.gbl... >I keep a log of checks that I receive in my department throughout the year. I have the checks lis...

My Outlook 2003 mail rules do not work even their are corectly co.
My Outlook 2003 mail rules do not work event their are corectly configured.I deleted all of them and reconfigure again but I have the same problem.The incoming messages are not delivered in the specified folder :( What should I do ? My office 2003 has all available patches installed. ...

DoCmd.RunSQL HELP!!! I will not work!
Hi all, I'm quite new to Access VBA (normally only work in Excel VBA). I was hoping the below code would return a SELECT query... Could anyone tell me why this code always returns with Run-time error '2342' A RunSQL action requires an arguement consisting of an SQL statement.? And if you could tell me the solution that would be great! Sub VBA_control_SQL_the_adventure_begins() Dim table_name As String Dim SQL As String SQL = "SELECT tblstaff.[Firstname], tblstaff.Lastname " & _ "FROM tblstaff;" DoCmd.RunSQL SQL End Sub ...

Balancing work expenses (reimbursable)
Question on correctly entering work expenses so they don't effect my spending by category. I have 3 transactions where I spent 100, 150, and 300 dollars for work expenses. I later received a reimbursement check from my employer for the total of all these transactions (550 dollars). The original transactions were charged to my credit card (I did not incur any interest charges). The reimbursement from my employer was sent to my checking account via direct deposit. I then paid off my credit card with a transfer from checking. How do I get this entered into Money so this doesn...

Display only part of table in combo box
I have a table of friendly names where each person may not have any or may have several. They are in a table with ID and name, such as: 1 Cat 1 Cathy 4 Fred 5 Ed 5 Eddie How can I get the combo box to only display Cat and Cathy for person # 1 and Fred for person # 4? Fred You could add another field to flag the ones to display. -- KARL DEWEY Build a little - Test a little "frederick" wrote: > I have a table of friendly names where each person may not have any or may > have several. They are in a table with ID and name, such as: > 1 Cat > 1 Cathy > 4 Fred &g...

Urgent! map network drive doesn't work
Hi, I run SBS 2008. I use GPO to map network drive, but it doesn't work. I have done the following: 1. Edit default domain policy -> user configuration -> Preferences -> Windows Settings -> drive maps 2. Link the GPO to SBSUsers folder 3. On XP workstation, run gpupdate /force 4. Installed Group Policy Preferences Client Side Extensions on XP 5. log off/log on back Still doesn't work. What did I miss? Need urgent help! Any help will be appreciated! Thanks in advance! Lisa On 2010-02-01 09:47:01 +0000, Lisa <Lisa@discussions.microsoft.com> sai...