Push from Access to Word; Word CheckBox Object


R

ryguy7272

I am trying to push data from a Form to a Word.doc. I had this working fine
for a document with Bookmarks, but when I set it up for another document,
with a different type of bookmark, a CheckBox, it didn’t work.

The name of the Form is ‘Parient’, all code is below:

Option Compare Database


Sub PatientForm()

Dim appWord As Word.Application
Dim doc As Word.Document
Dim objWord As Object

On Error Resume Next
err.Clear

Set appWord = GetObject(, "Word.Application")
Set objWord = CreateObject("Word.Application")

If err.Number <> 0 Then

objWord.Documents.Open CurrentProject.Path & "\test.doc"
objWord.Visible = True

End If
'Set doc = appWord.Documents.Open("C:\PatientForm.doc", , True)
Set doc = appWord.Documents.Open(CurrentProject.Path &
"\MontefioreRADON.doc", , True)
With doc

..CheckBox("Supine").Result = Forms!Patient!Supine
..CheckBox("Prone").Result = Forms!Patient!Prone
..CheckBox("ArmsUp").Result = Forms!Patient!ArmsUp
..CheckBox("ArmsSides").Result = Forms!Patient!ArmsSides
..CheckBox("ArmsAkimbo").Result = Forms!Patient!ArmsAkimbo
..FormFields("ReversedTable").Result = Forms!Patient!ReversedTable
..FormFields("Other").Result = Forms!Patient!Other

..Visible = True
..Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox err.Number & ": " & err.Description

End Sub

I Used Forms, Checkbox, named the Bookmark, and clicked ‘Check Box Enabled’.
I tried a few types of objects such as ‘.CheckBox’ and ‘.FormFields’, but
not together…one then the other. Nothing has worked so far.

What am I doing wrong?

Thanks,
Ryan---
 
Ad

Advertisements

R

ryguy7272

In Word > Forms > Check Box Form field, I am trying to populate CheckBoxes,
based on checks in an Access Form. I’ve tried multiple things and can’t seem
to get it working. Is this possible?

Thanks,
Ryan---
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top