Solved

Array is passing values with double double quotes to another procedure

Posted on 2012-03-20
6
414 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
  • 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 500 total points
ID: 37744690
Sorry about that - I missed a comma:

strSplit = Split(Replace(strCriteria, Chr(39), ""), ", ")
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

776 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