Solved

Filters - easy question (need quick answer)

Posted on 1997-07-29
2
615 Views
Last Modified: 2012-05-04
I am just missing something here I think, but I am trying to
run a filter on a table.  Heres the background, the user selects customers from a multi-pick list, these are then read into a table.  That part works.  

I then have a query that joins on the customer name to a table with customer data, and returns all the customer data, in effect only showing data about selected customers.  This is what my code does...

'DoCmd.OpenQuery "filtertest", acViewNormal, acEdit
DoCmd.OpenTable "RespondentList", acViewNormal, acEdit
DoCmd.SelectObject acTable, "RespondentList", False
DoCmd.ApplyFilter "filtertest"

on this last line (filtertest is the query mentioned above) I get an error Runtime error 2488, says that I have not selected a table to perform the query on.  And mentions that I should use SelectObject, which I do, but no to avail.  I need this answered pretty fast...

thanks, Matt Fischer
0
Comment
Question by:mfischer2
2 Comments
 

Accepted Solution

by:
Lesand earned 180 total points
ID: 1955452
Perhaps I don't know what you are trying to accomplish.

If you want to return a datasheet by means of a query that has been limited to a list of user-selected customers then do the following:

Create a query with 2 tables:
    All_Customers_DataTable
    User_Selected_Customers_List

In the QBE grid, link the tables on a common key field and  make sure that the link returns only records where the two fields are equal.  Save the query.
Now it will automatically return records filtered to those listed in the User_Selected_Customers_List

In code you can use docmd DoCmd.OpenQuery "filtertest", acViewNormal, acEdit   and it should always return the recordset limited by the user selections


0
 

Author Comment

by:mfischer2
ID: 1955453
I ended up not using filters, but thanks for the help.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

679 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