Results 1 to 3 of 3
  1. #1
    seeker63 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2013
    Posts
    3

    type mismatch

    Why would this line of code throw a type mismatch error?

    Dim sSQL2 as String
    sSQL2 = "Select * from dbo.TradeTransPrimary where combinedso = '" + cSO + "' AND marketingfirm = '2'"


    as i leave the line that populates sSQL2 a type mismatch error is given.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try & instead of + as a concatenation operator.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Not sure my observations are valid, but, if marketingfirm is actually numeric, then the single quotes around 2 are not needed.
    What are the + signs for?

    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. type mismatch
    By Compufreak in forum Access
    Replies: 5
    Last Post: 08-08-2012, 11:00 AM
  2. type mismatch
    By slimjen in forum Forms
    Replies: 21
    Last Post: 07-24-2012, 03:14 PM
  3. Type Mismatch....WHY?!!?
    By jgelpi16 in forum Queries
    Replies: 9
    Last Post: 03-07-2011, 09:18 AM
  4. Type mismatch
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 08-07-2010, 06:54 AM
  5. Type Mismatch - HELP!
    By jgelpi in forum Programming
    Replies: 3
    Last Post: 07-17-2009, 03:53 PM

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