+ Reply to Thread
Results 1 to 3 of 3

How to add Text type input vaule into SQL

  1. #1
    Registered User
    Join Date
    06-03-2008
    Posts
    20

    How to add Text type input vaule into SQL

    Hi

    The rmCode.Value should be a text vaule, but in the Set rs = cnn.Execute(SQL), the SQL become "select * from target where branch=TEXT". I need the SQL become to "select * from target where branch="TEXT"", otherwish it could not exe by SQL.

    Please refer to below code for details.

    Thank you!

    -----------------------------------------------------------------------
    SQL = "select * from target where branch= " & rmCode.Value & ""
    Set rs = cnn.Execute(SQL)

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Please take a couple of minutes and read the Forum Rules then wrap your VBA code (Rule 3)
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    Either use single quotes around the text value or double-up the double quotes, but easier to use the single quotes.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. changing import text default from general to text
    By shoshanako in forum Excel General
    Replies: 3
    Last Post: 02-17-2012, 08:22 AM
  2. combobox accepting text input
    By bernie1961 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2008, 02:30 PM
  3. Modifying a Input Box and Its Actions
    By eddie barzoon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2007, 08:43 PM
  4. Preserving text format/style - concatenate function
    By michaelc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-11-2006, 12:51 PM
  5. Replies: 1
    Last Post: 10-10-2006, 12:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1