Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Wrap String

Posted on 2007-04-05
1
Medium Priority
?
179 Views
Last Modified: 2012-05-05
Hi: This is the the string.
TxtString1 = "DBTRADDR" & "," & mAddress1A & "," & mAddress1B & "," & mCity1 & "," & mState1 & "," & mZip1 _
& "," & """"

And this is the result
DBTRADDR,100 E GRAND BLVD STE 100,"",CORONA,CA,928792222,""

My question is how to i put a double quotation mark around each field. Even if there is a value or no value in it. It must be wrap with double quotation mark like that. I try it but it not wrap the fields which have value in it.
DBTRADDR,"100 E GRAND BLVD STE 100","","CORONA","CA","928792222",""

Thanks.

TxtString1 = "DBTRADDR" & "," & iif (IsNull(mAddress1A), chr(34) & chr(34), mAddress1A) & "," &  iif (IsNull(mAddress1B), chr(34) & chr(34), mAddress1B) & "," &  iif (IsNull(mCity1), chr(34) & chr(34), mCity1) & "," &  iif (isNull(mState1) , chr(34) & chr(34), mState1) & "," &  iif (isNull(mZip1), chr(34) & chr(34), mZip1) _
& "," & """"
0
Comment
Question by:mustish1
1 Comment
 
LVL 3

Accepted Solution

by:
kingtam2000 earned 2000 total points
ID: 18861864
If you want to put quotation marks around the fields, then you would add "" (double quotes) before and after each field.  So, taking your string (I'm not sure if you want to put quotation marks around DBTRADDR, I'm assuming you don't):
TxtString1 = "DBTRADDR" & ", """ & mAddress1A & """, """ & mAddress1B & """, """ & mCity1 & """, """ & mState1 & """, """ & mZip1 & """, """ & """"
You can join up the first and last strings if you wanted to so it would be:
TxtString1 = "DBTRADDR, """ & mAddress1A & """, """ & mAddress1B & """, """ & mCity1 & """, """ & mState1 & """, """ & mZip1 & """, """""

If you wanted something different or need more help, just post a comment.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question