H
Hoodlum
This is my first post and i would like to say hi to every1 and thanks t
any1 who can help me.
Ive got a form that i can use information from to merge into word. Th
problem is i can only get information from the main part of the for
and not any of the subforms. Here is the code i have that works t
make a merged report in word:
Public Function MVR_3()
On Error Resume Next
Dim rsMV3_1 As Recordset, iTemp As Integer
Dim WordObj As Word.Application
Set rsMV3_1 = DBEngine(0).Databases(0).OpenRecordset("Subject"
dbOpenTable)
rsMV3_1.Index = "PrimaryKey"
rsMV3_1.Seek "=", Forms!Subjectform![Case Number]
If rsMV3_1.NoMatch Then
MsgBox "Invalid customer", vbOKOnly
Exit Function
End If
Set WordObj = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordObj = CreateObject("Word.Application")
End If
WordObj.Visible = True
WordObj.Documents.Add Template:="F:\Access Project\Acces
2002\Templates\MV3.dot", NewTemplate:=False
WordObj.Selection.Goto what:=wdGoToBookmark, Name:="Casenumber"
If IsNull(rsMV3_1![Case Number]) Then
WordObj.Selection.TypeText " "
Else
WordObj.Selection.TypeText rsMV3_1![Case Number]
End If
DoEvents
ChangeFileOpenDirectory "F:\Operations\Information Reports\"
WordObj.Activate
' Set the Word Object to nothing to free resources
Set WordObj = Nothing
DoCmd.Hourglass False
Exit Function
TemplateError:
Set WordObj = Nothing
Exit Function
End Function
Basically the above code takes the case number from the subjec
table/form and prints it in a bookmark in word. But i cant use or don
know how to get it to use other fields from the same form but o
subforms(confused yet?) to merge into the document. Like i sai
earlier any help would be appreciated
any1 who can help me.
Ive got a form that i can use information from to merge into word. Th
problem is i can only get information from the main part of the for
and not any of the subforms. Here is the code i have that works t
make a merged report in word:
Public Function MVR_3()
On Error Resume Next
Dim rsMV3_1 As Recordset, iTemp As Integer
Dim WordObj As Word.Application
Set rsMV3_1 = DBEngine(0).Databases(0).OpenRecordset("Subject"
dbOpenTable)
rsMV3_1.Index = "PrimaryKey"
rsMV3_1.Seek "=", Forms!Subjectform![Case Number]
If rsMV3_1.NoMatch Then
MsgBox "Invalid customer", vbOKOnly
Exit Function
End If
Set WordObj = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordObj = CreateObject("Word.Application")
End If
WordObj.Visible = True
WordObj.Documents.Add Template:="F:\Access Project\Acces
2002\Templates\MV3.dot", NewTemplate:=False
WordObj.Selection.Goto what:=wdGoToBookmark, Name:="Casenumber"
If IsNull(rsMV3_1![Case Number]) Then
WordObj.Selection.TypeText " "
Else
WordObj.Selection.TypeText rsMV3_1![Case Number]
End If
DoEvents
ChangeFileOpenDirectory "F:\Operations\Information Reports\"
WordObj.Activate
' Set the Word Object to nothing to free resources
Set WordObj = Nothing
DoCmd.Hourglass False
Exit Function
TemplateError:
Set WordObj = Nothing
Exit Function
End Function
Basically the above code takes the case number from the subjec
table/form and prints it in a bookmark in word. But i cant use or don
know how to get it to use other fields from the same form but o
subforms(confused yet?) to merge into the document. Like i sai
earlier any help would be appreciated