ACCESS to WORD form - Populate on Buttonpush (1 Viewer)

Xproterg

Registered User.
Local time
Today, 12:28
Joined
Jan 20, 2011
Messages
67
Well I've hit another brick wall. I can't seem to get the following code to work.

Code:
Private Sub Command112_Click()
'Print customer slip for current customer.
Dim appWord As Word.Application
Dim doc As Word.Document
Dim docdoc As String
docdoc = Application.CurrentProject.Path
docdoc = docdoc + "\printouts.docx"
'Avoid error 429, when Word isn't open.
On Error Resume Next
Err.Clear
'Set appWord object variable to running instance of Word.
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
'If Word isn't open, create a new instance of Word.
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open(docdoc, , True)
With doc
.FormFields("WORDfirst").Result = Me!firstname
.FormFields("WORDlast").Result = Me!lastname
.FormFields("WORDrank").Result = Me!Text23
.FormFields("WORDwcn").Result = Me!wcn
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description

End Sub


It is designed to take information from the form in access, and dump it onto a word form. The form is multiple pages long, and contains repetions of the four fields listed above. (more than the four listed, but they're taken out to shorten the code)

I don't get any errors, just a document that pops up, with the formfields still blank.

Any help on this would be greatly appreciated.

Thanks!
 

Xproterg

Registered User.
Local time
Today, 12:28
Joined
Jan 20, 2011
Messages
67
That is actually where i got the code from; however, it doesn't seem to be working.
 

Xproterg

Registered User.
Local time
Today, 12:28
Joined
Jan 20, 2011
Messages
67
I think this one may be a lost cause, which means I have to add individual bookmarks, and create like 75 more lines of code. :S
 

Xproterg

Registered User.
Local time
Today, 12:28
Joined
Jan 20, 2011
Messages
67
Still no answers on this, eh? I may just have to create like 200 bookmark references... I was hoping to be able to avoid doing that for redundant data.
 

Users who are viewing this thread

Top Bottom