I'm an Access novice; I customized the code below. The problem is it prints the primary key instead of the name of the field referred to.
For example, in one statement I want Institution Name to be printed in Word but instead it returns the primary key from a particula rinstitute in my table.
FormFields("txtNQFLevel").Result = Me.NQFLLEVEL
I would like this field from another table but in the same query to return string values referred not its opposite primary key value
FormFields("txtInstitute").Result = Me.Institute_Name
I would like this field which is from another table but in the same query to return string values referred not its opposite primary key value
Function BursaryContractYear2()
Dim appWord As Word.Application
Dim doc As Word.Document
Dim Path As String
On Error Resume Next
Error.Clear
Path = "C:\Users\Motlatsi Motlhamme\Desktop\FillWordAccess.docx "
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set appWord = New Word.Application
appWord.Visible = True
End If
Set doc = appWord.Documents.Open(Path, , True)
With doc
.FormFields("txtFirstName").Result = Me.FIRST_NAMES
.FormFields("txtSurname").Result = Me.SURNAME
.FormFields("txtNQFLevel").Result = Me.NQFLLEVEL
.FormFields("txtInstitute").Result = Me.Institute_Name
appWord.Visible = True
appWord.Activate
End With
Set doc = Nothing
Set appWord = Nothing
End Function