Copying an Access form into Word

aproctorpe001

Registered User.
Local time
Today, 07:33
Joined
Nov 19, 2001
Messages
17
I have created a large/content-rich/formatted form in Access and wish to copy it to Word so I can send it out as an attachment to an email to gather necessary input data. Is there anyway of doing this as I really don't want to have to manually create a replica of the form in Word.
 
Exporting the form to a *.rtf file will only export the data into a table.

If you want the appearance maintained you will need to take a screen shot of your active window.

Try "Alt+Print Scrn" with the form view active and then paste it into a Word doc.
 
I downloaded a great utility called PRINTKEY. It is a vary easy to use screen captue utility. You can capture the entire screen or define your own selection. I use the tool all the time for the same reasons that you need it. By the way, you can paste it in an e-mail and it works great without having to creat an attachment that the user may choose not to open.
 
Now I first want to say that each of us takes a different view on this issue, and not all of us are comfortable with using external applications. Having said this, I can tell you how we approached the same problem with Access vs. Word.

We developed our form in Word, not Access. Then we build an unbound Access form with some action buttons, one of which triggered some code. The code did an ActiveX open of the Word document.

Here is the trick we used. Using the COM methods, Word is ugly - but if you design it right, you can take advantage of a particular collection that turns out to be extremely useful.

First, make sure you have references to the MS Word object library. For Word97 the file is named MSWORD8.OLB, but I'm sure that the name will be similar for other versions.

One of the collections in a Word document is the Tables collection, where each table is of course indexed. The indices are in the order of table appearance in the document.

Within each table is a collection called Rows, where each row is indexed in the order that it appeared in the table. The number of rows is the Table(n).Rows.Count value.

Within each row there is a list of Cells, where each cell is indexed in the order it appears in the row. The number of cells is just the Table(n).Row(m).Cells.Count value.

So if you design your form using a table as its base structure, you can direct-access individual cells. For instance, assuming appropriate Dim statements,

set dbsCurrent = CurrentDB

set recsetXYZ = dbsCurrent.OpenRecordset("MyTable")

Set objApp = CreateObject("Word.Application")
objApp.Visible = False
objApp.Documents.Open {file-name}, False, False, False 'essentially, open read-only

...

recsetCurrent.AddNew
recsetCurrent.Edit


tableCurrent = objApp.Tables(longTable)

rowCurrent = tableCurrent.Row(longRow)

cellCurrent = rowCurrent(longColumn)

recsetCurrent.ItemX = cellCurrent.Range.Text

... more direct-access stuff.

' Eventually, you close the document with

objApp.Documents.Close savechanges:=wsDoNoSaveChanges
objApp.Quit
recsetCurrent.Update

...

recsetCurrent.Close


I used wordy item names, but the point is that you have direct access to each individual cell in the table no matter how many rows there are, and no matter how many cells there are, and for that matter, how many tables there are.

Further, it doesn't matter if any row has had a "Combine Cells" done. That row just has fewer cells than its neighbor rows. But you can decide that by rowCurrent.Count (= the number of cells).

As I understand it, if you combine cells vertically, the cell index stays with the first row in which that cell appears.

Just an alternative viewpoint on importing forms from Word to Access.

Final hint: Don't run this on a memory-poor machine. Both Access and Word must be co-resident for this to work right.


[This message has been edited by The_Doc_Man (edited 12-05-2001).]
 

Users who are viewing this thread

Back
Top Bottom