Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2004, 11:05 PM
Registered User
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default string concatenation


I am trying to create a string variable that I will use as a SQL argument. See example below.

user_input=TextBox.Value
strsql = "SELECT abc FROM def WHERE abc=" & user_input

The user input needs to be enclosed in apostrophes for the SQL statement to work, as abc is a Text value. So, the result I want is that strsql = SELECT abc FROM def WHERE abc="USER SELECTION"

How can I get apostrophes around the USER SELECTION, using a concatenation as shown above?

Thanks for any help that I can get on this!

Matt

 
Old January 17th, 2004, 06:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Matt

You should be able to use single quotes:

strsql = "SELECT abc FROM def WHERE abc='" & user_input & "'"

If not, you have to tell Access that you really, really want to put a double quote in there:

strsql = "SELECT abc FROM def WHERE abc=""" & user_input & """"


Brian Skelton
Braxis Computer Services Ltd.
 
Old January 17th, 2004, 09:55 AM
Authorized User
 
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

strsql = SELECT abc FROM def WHERE abc='" & USER_INPUT & "';"


Kenny Alligood





Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance in String concatenation rushman XSLT 4 September 27th, 2007 11:02 AM
concatenation string of an input file kgoldvas XSLT 11 September 10th, 2007 08:32 AM
String concatenation query. AjayLuthria XSLT 2 March 14th, 2007 11:55 AM
string concatenation nulogix PHP How-To 1 June 24th, 2004 06:17 AM
T-SQL String Concatenation jaucourt SQL Language 2 January 13th, 2004 10:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.