Link to home
Start Free TrialLog in
Avatar of Eric Sherman
Eric ShermanFlag for United States of America

asked on

Maximum Size of String Variable to Hold XML Document Created with VBA???

I am using Access and VBA to create an XML Document that will post to an IP for the purpose of faxing documents.  I have the VB code written to  accomplish this but my question is relating to...

Will the XML Document be limited to the 64k (I think) max size of a string variable???  This becomes a "VERY LARGE" string variable because the PDF file that's actually being faxed is encoded and included within the <document_list> </document_list> tags.  I did not post all the encoded results within those tags but I think you can get the idea if you review the output below from the strXMLDocument variable after it is created.  Within my test environment I can create and send faxes with 17 pages and have not received any errors but when the client ran the application in their environment the first time the got the message...

Run-time error '3163' The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.

The next time they ran the application it worked, sent the faxes and did not generate any errors. Strange!!!!

This is the only variable in the whole scheme of things I could think of that could possibly cause that error and is why I'm asking the question.


Dim XmlDocument as string

XmlDocument =  "xml document is created here"  and the output looks like the following ...

<?xml version="1.0" encoding="UTF-8"?>
<single_fax_info xmlns="http://www.protus.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SchemaVersion>1.2</SchemaVersion>
  <login_key>
    <user_id>54321</user_id>
    <user_password>mypassword</user_password>
  </login_key>
  <single_fax_options>
    <billing_code>Monthly Statement</billing_code>
    <from_name>MyCompany</from_name>
    <tiff_image_flag>false</tiff_image_flag>
    <resolution>high</resolution>
  </single_fax_options>
  <fax_recipient>
    <fax_recipient_number>13367891234</fax_recipient_number>
    <fax_recipient_name>John Doe</fax_recipient_name>
  </fax_recipient>
  <document_list>
<document document_content_type="application/PDF" document_encoding_type="base64" document_extension="PDF">JVBERi0xLjMNCjEgMCBvYmoNCjw8DQovQ3JlYXRvciA8RkVGRjAwNzAwMDY0MDA2NjAwNUYw
MDZFMDA2RjAwNkMwMDY1MDA3NDAwNzQwMDY1MDA3Mj4NCi9Qcm9kdWNlciA8RkVGRjAwN
"
"   
"                          <--------------This very large and is the encoded pdf file
"
"
"
JSVFT0YN
Cg==</document>
  </document_list>
</single_fax_info>


Mybe there's a better way to create that xml document rather than store it to a string variable.

ET
ASKER CERTIFIED SOLUTION
Avatar of flavo
flavo
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eric Sherman

ASKER

Thanks for the response flavo ....

The answer to your question, no.  Once the string XmlDocument is created and populated it is passed directly to the function that makes the post to the IP Services.

Originally I was thinking maybe I needed to insert the XmlDocument string variable into a memo type field in a temp table because of the following specifications and use the 1 gigabyte of character storage when entering data programmatically.

>>>>>>>Number of characters in a Memo field 65,535 when entering data through the user interface;  1 gigabyte of character storage when entering data programmatically.<<<<<<<<

My research always revealed the Max size of a string variable to be 65k characters.

You said ....

>>>>>In any case, the maximum size of a variable length (DIm s as string) string is ~2 billion characters.<<<<<

Kinda makes sense in that I've never received the error message in all my testing and the client only received it once (the first run) and it seemed to work from that point forward.

Any documented links to confirm the ~2 billion characters????

Thanks,

ET
Seems like the string variable should be sufficient to accommodate the XmlDocument based on the following.

Fixed String = 0 to 65,400 characters

Variable String = 0 to 2 billion characters


It's just strange they got that message the first time the application was run and the next time it was not generated.  

ET

Avatar of stevbe
stevbe

<Run-time error '3163' The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. >
What does your error log tell you? Because you are relying on their telling you about the error, are you really sure that it happened when they were processing that function? Are you sure that your error log is returning the correct module / procedure?
Thanks for the reply stevbe ....

I will be running some additional test today and see if I get the error again.  I received a screen shot of the VB Prompt with the message.  I generally get the customer to hit the debug then do a screen shot but this was a new employee.

ET
flavo & stevbe ...

I ran the function several times in the live environment for several batches of faxes and the error never appeared again.  Just kind of strange that it only happened that one time.

Oh well, thanks for the info on the max size of a variable length string.  For some reason I was thinking it was limited to the 65k.

ET