Results 1 to 6 of 6
  1. #1
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30

    Exclamation Syntax problem? Strings

    Hey guys axe again I'm still trying to figure out the joining strings thing but right now I'm trying to open a supplier record in a form by double clicking its name. I'm using a macro openform and I try to use the Where condition to determine in which record I want to open the form but it simply doesn't work well it does but it doesnt open the record I'm clicking. This is the condition y work with

    ="Supplier ='" & "Supplier1" & "'"



    Supplier is the field on the form I want to open and Supplier1 is the field in the form I'm working with.

    When working with numerical values it's easier I use this condition

    ="[Id]=" & [Id]

    This works as a charm but I need to work with strings and I'll be using alphanumeric Id's in other parts of the data base so I'll rather learn whats the correct syntax

    I hope someone can help thank you!

  2. #2
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Hi,
    you are using " double quoted around the Fieldname which is wrong, use it as you use for numeric field

    ="Supplier ='" & [Supplier1] & "'"
    For String data type, there should be single quotes & "'" before and after the text data type field.
    Hope this help.

  3. #3
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    khalid will you be kind enough to clarify? I really don't understand. Do you mean I should put it like this:

    ="Supplier ="" & [Supplier1] & "" or ="Supplier =' " " & [Supplier1] & " ' "

  4. #4
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Quote Originally Posted by axess_nab View Post
    khalid will you be kind enough to clarify? I really don't understand. Do you mean I should put it like this:

    ="Supplier ="" & [Supplier1] & "" or ="Supplier =' " " & [Supplier1] & " ' "
    No, it should be like this:

    For string data type:
    Code:
    ="Supplier ='" & [Supplier1] & "'" 
    For Numeric data type:
    Code:
    ="[Id]=" & [Id
    Remember that when you use string data type (text field) it should be enclosed in single quotes ' on both sides of the field, like '" & [Supplier1] & "'" and for numeric it should not be used, if you use it vise versa it will produce an error.

    Hope this clear.
    Last edited by khalid; 05-25-2011 at 02:04 PM. Reason: removing of colors from php code

  5. #5
    axess_nab is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    30
    khalid thank you very much. Till now I could try your solution and it worked like a charm I really appreciate the time you took to read my problem and give me the proper solution! I hope one day I can do the same for another newbie. Now I need to continue to work on my db Thanks again!

  6. #6
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Quote Originally Posted by axess_nab View Post
    khalid thank you very much. Till now I could try your solution and it worked like a charm...
    You are welcome axess..

    Glad that it solved the problem, yeah why not you will be able to solve the other's problems one day. Everyone can learn and achieve his goals with continuous struggles and hard work.

    Good Luck!

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

Similar Threads

  1. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM
  2. Evaluating Math Strings
    By Rawb in forum Programming
    Replies: 18
    Last Post: 09-01-2010, 07:50 AM
  3. Grouping strings
    By Fre in forum Access
    Replies: 16
    Last Post: 04-24-2010, 03:46 PM
  4. Syntax Contains Problem
    By pimlicosnail in forum Forms
    Replies: 9
    Last Post: 02-18-2010, 12:16 PM
  5. Strings limited to 255 characters
    By ocordero in forum Programming
    Replies: 4
    Last Post: 08-09-2006, 09:13 AM

Tags for this Thread

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