Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2008

Tip: Looking for answers? Try searching our database.

Move data in form field to a word doc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GuideDogsJoe - 09 May 2008 00:14 GMT
I have a form in access, I want to transfer fields within the form to a word
doc. I'm using a command button on the access form to open the word doc and
move the data to word, everything works. I'm able to move 4 of the 5 field
of data to the word doc except the memo field, since the field contains more
than 255 characters the data isn't moveing over to the defined txt field on
the word doc. Any suggestions on how I can move over this large string of
text.

Private Sub cmdMoveData_Click()
   Dim appWord As Object
   Dim doc As Object
   Dim FilePath As String
   
   FilePath = "C:\_ProjectFolders\MoveDataProject\MoveData.doc"
   
   'Avoid error 429, when Word isn’t open.
   On Error Resume Next
       err.Clear
   'Set appWord object variable to run instance of Word.
   Set appWord = CreateObject("Word.Application")
   Set doc = appWord.Documents.Open(FilePath, , True)
 
With doc
       .FormFields("hi_IntDate").Result = Me!textfield1
       .FormFields("hi_ResultsCampusePre").Result = Me!textfield2
       .FormFields("hi_ResultsCampusePTx").Result = Me!textfield3
       .FormFields("hi_ResultsResidtlTra").Result = Me!textfield4
       .FormFields("hi_ResultsNarrative").Result = Me!memofield1
these are the data fields I'm moving over the last move is a memo field and
since the field contains more than 255 characters the data is not moving to
the word doc.
       .Visible = True
       .Activate
   End With
   
   Set doc = appWord.Documents.Open(FilePath, , True)
   Set doc = Nothing
   Set appWord = Nothing
   Exit Sub
errHandler:
   MsgBox "An error of code " & err & " has occurred: " & Error, 48,
"fsubHomeInt - cmdMoveData_Click"
End Sub
Jeanette Cunningham - 09 May 2008 06:59 GMT
Joe,
here is a link about merging memo fields to Word.
http://groups.google.com/group/microsoft.public.access.externaldata/browse_threa
d/thread/e58ea71043b738d/ab5885dd258d6089?lnk=gst&q=merge+memo+field+to+word#ab5
885dd258d6089


Jeanette Cunningham -- Melbourne Victoria Australia

>I have a form in access, I want to transfer fields within the form to a
>word
[quoted text clipped - 45 lines]
> "fsubHomeInt - cmdMoveData_Click"
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.