Hi,
I have the following code:
Dim WordObj As Word.Application
Dim db As DAO.Database
Dim rsInspectionReport As Recordset
Dim mystrSQL As String
Set WordObj = CreateObject("Word.application")
Set db = CurrentDb
mystrSQL = "SELECT * FROM qryInspectionReportAll WHERE [InspNumber] =" & [Forms]![frmInspectionReportMenu]![txtIDNumber]
Set rsInspectionReport = db.OpenRecordset(mystrSQL)
With WordObj
.Visible = True
rsInspectionReport.MoveLast
rsInspectionReport.MoveFirst
Do Until rsInspectionReport.EOF = True
.Documents.Add ("\\rdc1\surety\surety reviews\suretyreview.dot")
.Activedocument.bookmarks("FNumber").Range.insertafter DLookup("[FindingNum]", "qryInspectionReportAll")
.Activedocument.bookmarks("Finding").Range.insertafter DLookup("[Finding]", "qryInspectionReportAll")
rsInspectionReport.MoveNext
Loop
End With
rsInspectionReport.Close
Set rsInspectionReport = Nothing
It creates the right number of documents (one for each finding), but the information is the same in each one even though it shouldn't be. It is like it doesn't move to the next record.
Any help would be appreciated. This is a Access 97 Database.
Lena
**Using Access 97 at work**
**Using Access 2003 at home**
lenawood@qwest.net
I have the following code:
Dim WordObj As Word.Application
Dim db As DAO.Database
Dim rsInspectionReport As Recordset
Dim mystrSQL As String
Set WordObj = CreateObject("Word.application")
Set db = CurrentDb
mystrSQL = "SELECT * FROM qryInspectionReportAll WHERE [InspNumber] =" & [Forms]![frmInspectionReportMenu]![txtIDNumber]
Set rsInspectionReport = db.OpenRecordset(mystrSQL)
With WordObj
.Visible = True
rsInspectionReport.MoveLast
rsInspectionReport.MoveFirst
Do Until rsInspectionReport.EOF = True
.Documents.Add ("\\rdc1\surety\surety reviews\suretyreview.dot")
.Activedocument.bookmarks("FNumber").Range.insertafter DLookup("[FindingNum]", "qryInspectionReportAll")
.Activedocument.bookmarks("Finding").Range.insertafter DLookup("[Finding]", "qryInspectionReportAll")
rsInspectionReport.MoveNext
Loop
End With
rsInspectionReport.Close
Set rsInspectionReport = Nothing
It creates the right number of documents (one for each finding), but the information is the same in each one even though it shouldn't be. It is like it doesn't move to the next record.
Any help would be appreciated. This is a Access 97 Database.
Lena
**Using Access 97 at work**
**Using Access 2003 at home**
lenawood@qwest.net