jpkeller55
Technical User
I have the following code that is populating data to a word document quite nicely. Now I need to have a checkbox from the Access Form populate its value to a checkbox on the Word document.
I have tried inserting this line to the code but what gets populated to the Word document is a 0 or -1.
How do I need to format the code for the check box value in word to be either checked or not checked based on the value of the Access check box? Thanks, JK
Code:
Public Function CreateWordLetter(strDocPath As String)
If IsNull(strDocPath) Or strDocPath = "" Then
Exit Function
End If
Dim objWord As Object
Dim PrintResponse
'Set dbs = CurrentDb
Set objWord = CreateObject("Word.Application")
With objWord
.Visible = True
.Documents.Open (strDocPath)
End With
If objWord.ActiveDocument.Bookmarks.exists("AgNm") = True Then
objWord.ActiveDocument.Bookmarks("AgNm").Select
objWord.Selection.TypeText Forms!NrsContFrm!NAname & ""
End If
If objWord.ActiveDocument.Bookmarks.exists("Attn") = True Then
objWord.ActiveDocument.Bookmarks("Attn").Select
objWord.Selection.TypeText Forms!NrsContFrm!NAcontact & ""
If objWord.ActiveDocument.Bookmarks.exists("Dt") = True Then
objWord.ActiveDocument.Bookmarks("Dt").Select
If IsDate(Forms!NrsContFrm!TodayDate) Then
objWord.Selection.TypeText Format(Forms!NrsContFrm!TodayDate, "mmmm d, yyyy")
Else
objWord.Selection.TypeText ""
End If
End If
Set objWord = Nothing
End Function
Code:
If objWord.ActiveDocument.Bookmarks.exists("check4") = True Then
objWord.ActiveDocument.Bookmarks("Check4").Select
objWord.Selection.TypeText Forms!NrsContFrm!Check1 & ""
End If