Solved

Wrap String

Posted on 2007-04-05
1
156 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 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.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now