Solved

Using VBA, how can I filter a table using a value in a multivalued field?

Posted on 2013-11-22
4
633 Views
Last Modified: 2013-11-23
I have a table in MS Access 2013 that, among other fields, contains a multivalued field.

Using VBA, I would like to filter the table based on a "normal" field AND by a value that might be contained in the multivalued field.

I already have the following working code in place to filter the table based on the "normal" Manufacturer field, but I'm stuck on adding in the multivalued Categories field.

Me.Filter = "[Manufacturer] = '" & Me.Field_Filter_Manufacturer & "'"
Me.FilterOn = True

Open in new window


Any help would be greatly appreciated!
0
Comment
Question by:CNeeper
4 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 300 total points
ID: 39671259
You must refer to the .Value property. For example:

Me.Filter = "[GroupField].Value In (1,2,3)"
Me.FilterOn = True

Or for a single value:

Me.Filter = "[GroupField].Value =1"
Me.FilterOn = True

If the values are Text:

Me.Filter = "[GroupField].Value ='1'"
Me.FilterOn = True
0
 
LVL 11

Assisted Solution

by:Swapnil Nirmal
Swapnil Nirmal earned 200 total points
ID: 39671264
Try this:

Me.Filter = "[Manufacturer].value = '" & Me.Field_Filter_Manufacturer & "'"
Me.FilterOn = True

Open in new window

0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 39671927
Not really an answer to your question, but my advice is to get all Taylor Swift and never ever ever use multi-valued fields.  Really.

:)
0
 
LVL 1

Author Closing Comment

by:CNeeper
ID: 39671934
Awesome! Those were the examples I needed! Thanks a million!
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now