Chintsapete
Registered User.
- Local time
- Today, 20:39
- Joined
- Jun 15, 2012
- Messages
- 137
I'm using below code to output employee info onto word document. It works except, it outputs the title ID instead of the title. The tables "employees" and "title" are many-to-one related and it works everywhere else.
Is there a way to make it look up the title instead of the ID?
Many thanks for any help
Is there a way to make it look up the title instead of the ID?
Code:
Private Sub Command187_Click()
Dim appWord As Object
Dim doc As Word.Document
On Error Resume Next
Error.Clear
Set appWord = GetObject("Word.Application")
If Error <> 0 Then
Set appWord = New Word.Application
End If
On Error GoTo errHandler
Set doc = appWord.Documents.Open("C:\Users\Server-new\Documents\Accounting\Payroll\NEW REVISED 3 MONTHLY CONTRACT.docx", , True)
appWord.Visible = True
With doc
If IsNull(Me.Title) Then
.FormFields("txtTitle").Result = ""
Else
.FormFields("txtTitle").Result = Me.Title 'outputs the table ID and not the title.
End If
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub
Many thanks for any help