Results 1 to 3 of 3
  1. #1
    Ferrugius is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2016
    Posts
    2

    [Newbie question] Filter not working on column sourced from the other table

    Hello! I've just started learning MS Access and I'm having trouble filtering data in column that sources options from the other table.

    I wanted to create a simple search box in split form by using a macro that applies filter to data in specific column. The macro is activated by clicking on a button and sources search phrase from the text box next to it.

    This is how it looks like:
    [SPOILER]
    Click image for larger version. 

Name:	Przechwytywanie.jpg 
Views:	8 
Size:	77.8 KB 
ID:	25090
    [/SPOILER]

    And this is the condition for the filter (Formularze -> Forms, Tekst82 -> name of the textbox):
    Code:
    [Target name] Like "*" & [Formularze]![Targets]![Tekst82] & "*" Or [Country] Like "*" & [Formularze]![Targets]![Tekst82] & "*" Or [Type] Like "*" & [Formularze]![Targets]![Tekst82] & "*"
    Searching works perfectly for "Target name" which has text data type, but it doesn't work (after applying filter no records are shown) for "Country" or "Type" which source available options from other tables.



    Could you help me solve this problem?

  2. #2
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    If Country is looked up in another table, the real search value will probably be a long number, not a text. To easily fix this: base your form on a query withon all involved tables and include not only the foreign key columns but also the text value columns of the the linked tables. Then filter on the text value fields, not on the numeric key-fields.
    For instance if you have tblCountries ([CountryID] , [CountryName]) include both fields in the query but filter on [CountryName]

  3. #3
    Ferrugius is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2016
    Posts
    2
    It worked! Thank you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-01-2014, 06:51 PM
  2. Replies: 7
    Last Post: 11-23-2013, 07:16 AM
  3. Replies: 5
    Last Post: 09-21-2012, 11:23 AM
  4. Replies: 6
    Last Post: 03-14-2011, 09:37 AM
  5. Newbie filter question
    By benplace in forum Access
    Replies: 1
    Last Post: 12-03-2005, 08:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums