K
Kenny G
I get the message DatabaseName Can't find the field 'DirectorCoordinator'
entered in your expression. Run Time Error 2465
I am using bookmarks to obtain data from a table for this letter.
Below is my code and if you can take a look at it and please tell me what is
incorrect.
Thanks,
Sub PrintTracerSurveyReport(sfrmReports)
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objBookmarks As Bookmark
'Launch Word and load the JCAHOTracerPreSurveyReport template
Set objWord = New Word.Application
objWord.Visible = True
Set objDoc = objWord.Documents.Add("S:\Quality & Process
Improvement\QPI\JCAHO PreSurvey Tool\Documents\JCAHOPreSurveyReport3.dot")
'Add information using predefined bookmarks
With objDoc.Bookmarks
.Item("DirectorCoordinator").Range.Text =
[sfrmReports].Form!DirectorCoordinator
.Item("SurveyID").Range.Text = [sfrmReports].Form!SurveyID
.Item("SurveyDate").Range.Text = [sfrmReports].Form!SurveyDate
.Item("SubSiteName").Range.Text = [sfrmReports].Form!SubSiteName
.Item("Standard").Range.Text = [sfrmReports].Form!Standard
.Item("Observation").Range.Text = [sfrmReports].Form!Observation
.Item("Recommendation").Range.Text =
[sfrmReports].Form!Recommendation
.Item("FollowupComments").Range.Text =
[sfrmReports].Form!FollowupComments
End With
objWord.PrintOut
objDoc.Close wdDoNotSaveChanges
objWord.Quit
End Sub
entered in your expression. Run Time Error 2465
I am using bookmarks to obtain data from a table for this letter.
Below is my code and if you can take a look at it and please tell me what is
incorrect.
Thanks,
Sub PrintTracerSurveyReport(sfrmReports)
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objBookmarks As Bookmark
'Launch Word and load the JCAHOTracerPreSurveyReport template
Set objWord = New Word.Application
objWord.Visible = True
Set objDoc = objWord.Documents.Add("S:\Quality & Process
Improvement\QPI\JCAHO PreSurvey Tool\Documents\JCAHOPreSurveyReport3.dot")
'Add information using predefined bookmarks
With objDoc.Bookmarks
.Item("DirectorCoordinator").Range.Text =
[sfrmReports].Form!DirectorCoordinator
.Item("SurveyID").Range.Text = [sfrmReports].Form!SurveyID
.Item("SurveyDate").Range.Text = [sfrmReports].Form!SurveyDate
.Item("SubSiteName").Range.Text = [sfrmReports].Form!SubSiteName
.Item("Standard").Range.Text = [sfrmReports].Form!Standard
.Item("Observation").Range.Text = [sfrmReports].Form!Observation
.Item("Recommendation").Range.Text =
[sfrmReports].Form!Recommendation
.Item("FollowupComments").Range.Text =
[sfrmReports].Form!FollowupComments
End With
objWord.PrintOut
objDoc.Close wdDoNotSaveChanges
objWord.Quit
End Sub