473,418 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

256 Caracters

21
Good Day.

I am currently via Form send data to a word template..
I have about 150 bookmarks in a word document which was previously imported via a simular document. and appended into my DB. The data changes etc we export it back for various reasons.

I use the following

Code:
--------------------------------------------------------------------------------

Private Sub ExportPDForm_Click()
Dim wrdApp As Object
Dim wrdDoc As Object
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Add(CurrentProject.Path & "\Personal Data Form.dot")
With wrdDoc
.FormFields("Title").Result = Me.Form.Title
.FormFields("FirstName").Result = Me.Form.[First Name]
.FormFields("AddInfo1").Result = Me.Form.[Add Information1]
.FormFields("AddInfo2").Result = Me.Form.[Additional Information2]
.FormFields("SummCivSkills1").Result = Me.Form.[Summary Civ Skills1]
.FormFields("SummCivSkills2").Result = Me.Form.[Summary Civ Skills2]
.FormFields("SummMilSkills1").Result = Me.Form.[Summary Mil Skills1]
.FormFields("SummMilSkills2").Result = Me.Form.[Summary Mil Skills2]
.FormFields("SummCompSkills1").Result = Me.Form.[Computer Skills1]
.FormFields("SummCompSkills2").Result = Me.Form.[Computer Skills2] etc etch... + 150 records
End With
wrdDoc.SaveAs gcPDExportPath & ID
wrdApp.Visible = TrueEnd Sub
--------------------------------------------------------------------------------


Due to the fact that some of the data in my DB is in a memo field ( The fields listed in blue ) Consist of more than 256 caracters i get a string to long error.

I then search the internet and found the following from a MPV website on how to by pass it.

Code:
--------------------------------------------------------------------------------

If you use:

Dim FmFld As FormField,
Str1 As StringStr1 = (a long string > 256 characters)
Set FmFld = ActiveDocument.FormFields(1)
FmFld.Result = Str1

You get an error: “String too long” (a ridiculous “design” feature, given that you can do it manually without problems!).Same if you use:

ActiveDocument.Formfields("Text1").Result = Str1
You can get round this by using:
ActiveDocument.UnprotectFmFld.Range.Fields(1)
.Result.Text = Str1ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

Or if you're referring to the formfield by name:ActiveDocument.UnprotectActiveDocument.Bookma rks("Text1").Range.Fields(1).Result.Text = Str1ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
--------------------------------------------------------------------------------


Now i have tried various ways to try and change my current code to make use of the above code. But Removed the to unprotect Document/ protect doc due to the fact that it would replace my bookmarks for later use.

I was hoping someone could perhaps assist in how i could amend the above mentioned. To allow the insert of records more than 256 caracters. Since the ways i have tried still gives me my String To long Error. Any advise would be apreciated.

Kind Regards
Sn
Aug 29 '07 #1
1 1940
FishVal
2,653 Expert 2GB
Hi, there.

FormField.Result property is String type, here is nothing to do from Access side. Try to drop a value to FormField.Range. Use it for memo fields only as soon as the operation destroys field.
Expand|Select|Wrap|Line Numbers
  1. .FormFields("Title").Range = Me.Form.Title 
  2.  
Aug 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Psykotik | last post by:
Hello, I've two problems with php. My spec : Windows XP SP1, KFWS 2.2.0, IE 6 SP1, PHP 4.3.3. Web server is "KF web server", a server very very user friendly (HTML interface), and which...
5
by: Mats | last post by:
Hi I run a small business on my own, everything from deliveries to coding the webshop. This limits the time I can spend on coding, so I hope I'm not asking to stupid questions. At present I'm...
1
by: Matthias HALDIMANN | last post by:
When importing data into MS SQL Server 2000 from a MyODBC (v3.51) data source using Data Transformation Services, special characters like öäüéàè are not imported correctly. However, when the MyODBC...
1
by: Fabiano | last post by:
Please, i got an XML String that contains some special caracters like linefeed, tab and others. How can i replace this chars? Can i use an ASCII value at the XXX.replace() method? Tks in...
2
by: David Scemama | last post by:
Hi, I'm looking for a way to display semi graphic characters in a multi line text control or in a rich text control. I've tried with all the characters of the extended ASCII table (code page...
2
by: alain.hogue | last post by:
I have a table "tblCards" with a field "Titre" that contain french words (Hébert, Gagné, Hélène, etc....) in an database with SQLEXPRESS 2005. I have used the asp:SqlDataSource to filter the...
7
by: arno | last post by:
Hi, I want to search a substring within a string : fonction (str, substr) { if (str.search(substr) != -1) { // do something } }
4
by: Jon | last post by:
Hello all, In my code im using Response.Write(someText) to write out some Japanese text to a new browser window. In the command window, the text is correct, but when the browser window opens it...
2
by: Mihai | last post by:
In a list box I have on each line a combination of string1 + String2. I want to write string 1 with a colour and string2 with another colour. I tried to use string1.format but I cannot find any...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.