Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-11-22
4
Medium Priority
?
756 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1200 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 800 total points
ID: 39671264
Try this:

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

Open in new window

0
 
LVL 93

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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

650 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