Wrap String

Posted on 2007-04-05
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",""


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) _
& "," & """"
Question by:mustish1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

kingtam2000 earned 500 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.

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

Suggested Solutions

Title # Comments Views Activity
How to Add / Edit Windows Menu 4 74
Visual Studio 2005 text editor 10 49
VBA: loop recent folder and copy txt file. 8 51
Macro problems with Excel file 6 27
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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