Results 1 to 3 of 3
  1. #1
    exupery is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    2

    Where condition

    Hi, In old version access we had this where condition:
    ="[supplier_code]=" & [supplier_code]
    and if I use it in access 2016 in our new database, it doesnīt work.


    What I want is, after doubleclick on supplier name, filter only supplier with same name or same code.
    I tryed everithing (almost), but I canīt get what I want. My last version of where condition is:
    =""&[Supplier name]&""="" & [Supplier name]& ""
    but in this is some syntactic mistake. Please help me. (Sorry for my english, central europe country)

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    instead of code, can you not just right click and select EQUALS 'name'?
    no coding needed.

    you can make a text box in the header and type in the name then pressing enter will filter.
    your above code works ONLY if supplier code is numeric.
    if supplier code is string, you must have quotes around it....
    me.filter = "[supplier_code]='" & [supplier_code] & "'"


    Code:
    sub txtFilter_afterupdate()
    if IsNull(txtFilter) then
       me.filterOn = false
    else
       me.filter = "[supplier_code]=" & [supplier_code]
       me.filterOn = true
    endif
    end sub

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by exupery View Post
    Hi, In old version access we had this where condition:
    ="[supplier_code]=" & [supplier_code]
    and if I use it in access 2016 in our new database, it doesnīt work.
    Welcome to the forum...

    "doesnīt work" doesn't give a lot of information. Is there an error message?

    Would you post the code for the double click event?

    Are you setting the form filter property??

    It sounds like you have a text box that is bound to the field "supplier_code". Is "supplier_code" a text type field?
    Text MUST be delimited with single quotes (in this case). If yes, try
    Code:
    ="[supplier_code] = '" & [supplier_code] & "'"
    Expanded, it looks like ="[supplier_code] = ' " & [supplier_code] & " ' "

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

Similar Threads

  1. Where condition
    By DavidTCH in forum Access
    Replies: 3
    Last Post: 03-25-2016, 09:07 PM
  2. Add second where condition
    By tagteam in forum Access
    Replies: 4
    Last Post: 03-22-2016, 03:46 PM
  3. Where Condition
    By NISMOJim in forum Programming
    Replies: 4
    Last Post: 04-09-2014, 11:10 PM
  4. Help with using the AND condition
    By ssturges in forum Access
    Replies: 1
    Last Post: 11-25-2012, 12:36 AM
  5. How to use IIF condition
    By nshaikh in forum Queries
    Replies: 4
    Last Post: 09-12-2008, 01:23 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