troubleshooting Question

MS Access VBA Text String Missing From The End Of A String After Stream

Avatar of Dustin Stanley
Dustin Stanley asked on
Microsoft AccessVBA
8 Comments1 Solution158 ViewsLast Modified:
I am building a string and at the very bottom of the string is a file being streamed into the text. But the is supposed to be a small section of string after the stream. It is missing!

xmlFile = "<?xml version=""1.0"" encoding=""UTF-8""?><uploadFileRequest xmlns=""http://www.ebay.com/marketplace/services""><taskReferenceId>" & TaskRefId & "</taskReferenceId><fileReferenceId>" & FileRefId & "</fileReferenceId><fileFormat>gzip</fileFormat><fileAttachment><Data><xop:Include href=""cid:urn:uuid:" & FileAttachmentUUID & """  xmlns:xop=""http://www.w3.org/2004/08/xop/include""/></Data><Size>15</Size></fileAttachment></uploadFileRequest>"
    strFile = GetFile(strFileName) 'Calls GetFile and loads the (Gzip Format) File as a binary attachment.

'***********************************************************************************************************
'Build The body
'***********************************************************************************************************
strBody = vbNewLine & vbNewLine & "--MIMEBoundaryurn_uuid_" & RequestUUID & vbNewLine 'Unsure of line spacing between header and Body 1,2,or 3?????
'strBody = strBody & "Content-Disposition: form-data; name="fieldNameHere"; filename="uploadFileNEWGOOD.xml" & vbNewLine
strBody = strBody & "Content-Type: text/xml" & vbNewLine
strBody = strBody & "Content-Transfer-Encoding: binary" & vbNewLine
strBody = strBody & "Content-ID: <0.urn:uuid:" & XMLUUID & ">" & vbNewLine
strBody = strBody & vbNewLine  'Space between XML File Header and XML File Body!

strBody = strBody & xmlFile & vbNewLine 'XML uploadFile File Body!
strBody = strBody & "--MIMEBoundaryurn_uuid_" & RequestUUID & vbNewLine
'strBody = strBody & "Content-Disposition: form-data; name="fieldNameHere"; filename="AFPIBulkTest1.gz" & vbNewLine
strBody = strBody & "Content-Type: application/x-gzip" & vbNewLine
strBody = strBody & "Content-Transfer-Encoding: binary" & vbNewLine
strBody = strBody & "Content-ID: <0.urn:uuid:" & FileAttachmentUUID & ">" & vbNewLine
strBody = strBody & vbNewLine  'Space between File Attachment Header and File Attachment Body!

        

strBody = strBody & strFile
strBody = strBody & "--MIMEBoundaryurn_uuid_" & RequestUUID & "--"

'*********************************************
'Returns file contents As a binary data
'*********************************************
Function GetFile(Filename)
  Dim Stream: Set Stream = CreateObject("ADODB.Stream")
  Stream.Type = 1 'Binary is value 1.
  Stream.Open
  Stream.LoadFromFile Filename
  GetFile = Stream.Read
  Stream.Close
End Function


strBody = strBody & strFile This is the stream
strBody = strBody & "--MIMEBoundaryurn_uuid_" & RequestUUID & "--" This part is missing!

Thanks.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros