Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Array is passing values with double double quotes to another procedure

Posted on 2012-03-20
6
Medium Priority
?
422 Views
Last Modified: 2012-03-20
I am working on taking a string of user ids in a text box, changing themto an array adn then passing each userid to a procedure.  However, I don't know why I keep getting double double quotes when it passes the aarry values.  What appears in the text box is in the fomat of   "ssmith", "jones", "brown"    This procedure is in VBA behind an Access 2003 form.

Sandra

'Create email and text to Administration with user's suggestion
On Error GoTo ErrorHandler
Dim EmailBody As String
Dim ToEmailAddress As String
Dim FromEmailAddress As String
Dim strSelect As String
Dim strCriteria As String
Dim strSplit() As String
Dim i As Integer

FromEmailAddress = "sgsmith@someplace.com"
ToEmailAddress = "sgsmith@someplace.com"
strCriteria = Me.txtCriteria

strSplit = Split(strCriteria, ", ")
For i = LBound(strSplit) To UBound(strSplit)
    EmailBody = BuildEmailBody(strSplit(i))   'Sends string with double double quotes - ""ssmith"" - WHY??
   
    If SendValidationEmailExchange(FromEmailAddress, ToEmailAddress, "Employee Validation", EmailBody) Then
        MsgBox "Email has been sent.", vbCritical + vbOKOnly, "Email Has Been Sent'"
                DoCmd.Close acForm, Me.Name
    End If
Next
0
Comment
Question by:ssmith94015
[X]
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
  • 4
  • 2
6 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37744603
Change your split statement to:

strSplit = Split(Replace(strCriteria, chr(39),"") ", ")
0
 

Author Comment

by:ssmith94015
ID: 37744640
I pasted your statement into my code, but it turned red.  It looks ok so am not surewhat I am missing.

Sandra
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 37744690
Sorry about that - I missed a comma:

strSplit = Split(Replace(strCriteria, Chr(39), ""), ", ")
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 61

Expert Comment

by:mbizup
ID: 37744695
If that doesn't work, post the code for your BuildEmailBody function, which may be adding quotes into the resulting string.
0
 

Author Closing Comment

by:ssmith94015
ID: 37745082
Yes, it helpded, thank you.

Sandra
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37745269
Glad that worked out ;-)

<< 'Sends string with double double quotes - ""ssmith"" - WHY?? >>

As to the "WHY?", all the split function does is seperate strings that are delimited by commas (or whatever delimiter is specified in the second argument of the split function).

So "ssmith", "mbizup", "myname", "etc" would be split into array elements as follows, including the quotes:

"ssmith"
 "mbizup"
 "myname"
 "etc"

If you were seeing "double double quotes", I'd have to guess that your function BuildEmailBody at some point adds more quotes.  So you could either resolve this by changing the function to not add quotes, or you could remove quotes from the string before passing it  to the function (as we did here).
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

598 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