Hi Guys,
I got bookmark added on word template where I want to display data from MS access query. The following code is written in Access but it doesn't populate any data in word document. I tried to run the query and it works fine but bk.range gives me null value in the following code:
ANy help will be much appreciated.
I got bookmark added on word template where I want to display data from MS access query. The following code is written in Access but it doesn't populate any data in word document. I tried to run the query and it works fine but bk.range gives me null value in the following code:
Code:
With CurrentDb.OpenRecordset("SELECT StandardDocs,strScore FROM qry_FormsCat_CallAudit_OverallScore WHERE (Section like 'Customer Outcome*') AND AuditID=" & Me.txtAuditID & "")
Set bk = wd.Bookmarks("CustomerOutcome")
'Set wt = wd.Tables.Add(wd.Parent.Selection.Range, 1, 3)
Set wt = wd.Tables.Add(bk.Range, 1, 2)
wt.Columns(1).Width = 465
wt.Columns(2).Width = 50
' wt.Columns(3).Width = 150
' RowFormat wt.Range, False
If Not .BOF = True And .EOF = True Then
Do Until .EOF
OutcomeScore = 0
'CurSec = Split(.Fields(0), ".")
Set wr = wt.Rows.Add
' wr.Cells(1).Range.Text = CurSec(1) & "." & CurSec(2)
wr.Cells(1).Range.Text = .Fields(0)
wr.Cells(2).Range.Text = .Fields(1)
' wr.Cells(3).Range.Text = .Fields(2)
' OutcomeScore = OutcomeScore + (.Fields(1)) * 10
.MoveNext
Loop
wt.Rows(1).Delete
End If
ANy help will be much appreciated.