Results 1 to 4 of 4
  1. #1
    DavidTCH is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    2

    Question Where condition


    I am using Access 2010 to Search for a Record. What is wrong with this "Where condition" : ="[StockName]=" & "'[TempVars]![VarStockName]'". The field in the table call tblStock is "StockName" and its a text field. The Variable: VarStockName is also a text. Why can't it work? Please Help to correct. Tq

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Perhaps it should be:"[StockName]='" & [TempVars]![VarStockName] & "'"
    Last edited by Bob Fitz; 03-25-2016 at 10:56 AM. Reason: Added space after &
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You have the quotes in the wrong place. Try this:

    ="[StockName]= '" & [TempVars]![VarStockName] & "'"

    Notice that the reference [TempVars]![VarStockName] is outside all quotes.

    It helps if when something "doesn't work" you say why it doesn't, and state what the error message is (if there is one).

  4. #4
    DavidTCH is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2016
    Posts
    2
    Understood. Thank you very much. Problem solved

    Quote Originally Posted by John_G View Post
    You have the quotes in the wrong place. Try this:

    ="[StockName]= '" & [TempVars]![VarStockName] & "'"

    Notice that the reference [TempVars]![VarStockName] is outside all quotes.

    It helps if when something "doesn't work" you say why it doesn't, and state what the error message is (if there is one).

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

Similar Threads

  1. Add second where condition
    By tagteam in forum Access
    Replies: 4
    Last Post: 03-22-2016, 03:46 PM
  2. Where Condition
    By NISMOJim in forum Programming
    Replies: 4
    Last Post: 04-09-2014, 11:10 PM
  3. Help with using the AND condition
    By ssturges in forum Access
    Replies: 1
    Last Post: 11-25-2012, 12:36 AM
  4. hours + condition
    By Miriam in forum Queries
    Replies: 0
    Last Post: 08-09-2009, 06:46 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