Results 1 to 3 of 3
  1. #1
    baendres is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    1

    Search functionality in form

    I have a database that contains 3 tables

    Drawings
    Plant_area
    Vendors

    two of the columns(fields) in the Drawings table are lookups from the other two tables in the database.

    the Plant_area table and Vendors table both contain only two columns, the id and another field

    The problem i am having is the search function the I have found/modified is not searching what is displayed in the form it is using the id of what is in the field. I have used mysql in the past and some of the stuff that access does is very different.

    this is in an embedded macro on a "go" button

    If [Froms]![Drawing list]![SearchBox] Is Null Then
    End If

    SetTempVar
    Name strSearch
    Expression = Replace([Forms]![Drawing List]![SearchBox],"""","""""")

    SetTempVar
    strFilter
    Expression = "([Drawing_Number] Like ""*" & [TempVars]![strSearch] & "*"")"
    SetTempvar
    strFilter
    Expression = [TempVars]![strFilter] & " OR ([Drawing_Title] Like ""*" & [TempVars]![strSearch] & "*"")"
    SetTempvar
    strFilter
    Expression = [TempVars]![strFilter] & " OR ([Area] Like ""*" & [TempVars]![strSearch] & "*"")"
    SetTempvar
    strFilter
    Expression = [TempVars]![strFilter] & " OR ([Vendor] Like ""*" & [TempVars]![strSearch] & "*"")"
    SetTempvar
    strFilter
    Expression = [TempVars]![strFilter] & " OR ([Equipment] Like ""*" & [TempVars]![strSearch] & "*"")"
    SetTempvar
    strFilter
    Expression = [TempVars]![strFilter] & " OR ([Notes] Like ""*" & [TempVars]![strSearch] & "*"")"
    SetTempvar
    strFilter
    Expression = [TempVars]![strFilter] & " OR ([Digital_Drawing] Like ""*" & [TempVars]![strSearch] & "*"")"

    ApplyFilter
    Filter Name
    Where Condition = =[TempVars]![strFilter]
    Control Name
    RemoveTempVar
    Name strFilter
    RemoveTempVar
    name strSearch


    SetProperty
    Control Name cmdShowAll
    Property Enabled
    Value 1


    If i search for the number 1, I get records that have an area and vendor with id number 1

    I would expect something like this to go in place of [area], drawing.area.area
    But i can't find any information on how MS Access handles this situation.

    any help would be appreciated.

    Thanks,
    Brian

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,738
    What is your database about? What do the tables mean? How are they related?

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    If I understand your question; I think your issue is that the search is finding the underlying ID field's value and not the value you see displaying in the field. This is the way it is.

    So what you need to do is modify your query (record set / data source of the form) to include the displayed field of the Plant_area table and Vendors table. use these fields and remove the lookup field from your record source and form.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-02-2013, 04:33 PM
  2. Replies: 1
    Last Post: 04-20-2012, 03:16 AM
  3. Form Button loses functionality after Save
    By gregu710 in forum Forms
    Replies: 2
    Last Post: 01-17-2012, 05:13 PM
  4. Replies: 3
    Last Post: 07-05-2011, 01:54 PM
  5. Semi-colon Functionality
    By TheDeceived in forum Access
    Replies: 3
    Last Post: 09-22-2010, 10:52 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