Hi,
I am new to this form so please be gentle.
so iam attempting to move information from access into a word document but get the following error.
"Compile error:
User-defined type not defined"
and cant figure out why :banghead:
any help would be much appreciated
I have set up the text form fields in word which are named.
attxt
sntxt
cntxt
sutxt
My code on my form button is the following
----------------------------------------------------------------------------------
Private Sub cmdprint_Click()
Dim appWord As msWord.Application
Dim doc As Word.Document
On Error Resume Next
Err.Clear
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open("C:\User\Shabir\Desktop\TeacherCS.doc", , True)
With doc
.FormFields("attxt").Result = Me.Reference_Full_Name
.FormFields("sntxt").Result = Me.Reference_Source
.FormFields("cntxt").Result = Me.Teacher_First_Name
.FormFields("sutxt").Result = Me.Teacher_Surname
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub
----------------------------------------------------------------------------
I am new to this form so please be gentle.
so iam attempting to move information from access into a word document but get the following error.
"Compile error:
User-defined type not defined"
and cant figure out why :banghead:
any help would be much appreciated

I have set up the text form fields in word which are named.
attxt
sntxt
cntxt
sutxt
My code on my form button is the following
----------------------------------------------------------------------------------
Private Sub cmdprint_Click()
Dim appWord As msWord.Application
Dim doc As Word.Document
On Error Resume Next
Err.Clear
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open("C:\User\Shabir\Desktop\TeacherCS.doc", , True)
With doc
.FormFields("attxt").Result = Me.Reference_Full_Name
.FormFields("sntxt").Result = Me.Reference_Source
.FormFields("cntxt").Result = Me.Teacher_First_Name
.FormFields("sutxt").Result = Me.Teacher_Surname
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox Err.Number & ": " & Err.Description
End Sub
----------------------------------------------------------------------------