please help, I am trying to transfer the query result to the bookmarks in a word document I have already created
it stops at
Set rst = db.OpenRecordset("QryHousingBenefit")
telling me there is two few parameters.expected 1
I have checked the query and it is producing the right results
does anyone know where I am going wrong? or point me in the right direction?
Private Sub HousingBenefit_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim doc As Word.Document
Dim MyWord As Word.Application
Dim HAddress As String
Dim HAddress1 As String
Dim TName As String
Dim MRent As String
Dim MRent1 As String
Dim Deposit As String
Set db = CurrentDb
Set rst = db.OpenRecordset("QryHousingBenefit")
rst.MoveFirst
Set doc = MyWord.Documents.Open("C:\Documents and Settings\Compaq_Owner\My Documents\Dee\Houses\SET UP DOCS\Housing Benefit Authorisation Form May 2011.docx")
HAddress = rst!HouseAddress
HAddress1 = rst!HouseAddress1
TName = rst!TenantName
MRent = rst!MonthlyRent
MRent1 = rst!MonthlyRent1
Deposit = rst!Deposit
doc.Bookmarks("HouseAddress").Range.Text = HAddress
doc.Bookmarks("HouseAddress1").Range.Text = HAddress1
doc.Bookmarks("TenantName").Range.Text = TName
doc.Bookmarks("MonthlyRent").Range.Text = MRent
doc.Bookmarks("MonthlyRent1").Range.Text = MRent1
doc.Bookmarks("Deposit").Range.Text = Deposit
End Sub
it stops at
Set rst = db.OpenRecordset("QryHousingBenefit")
telling me there is two few parameters.expected 1
I have checked the query and it is producing the right results
does anyone know where I am going wrong? or point me in the right direction?
Private Sub HousingBenefit_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim doc As Word.Document
Dim MyWord As Word.Application
Dim HAddress As String
Dim HAddress1 As String
Dim TName As String
Dim MRent As String
Dim MRent1 As String
Dim Deposit As String
Set db = CurrentDb
Set rst = db.OpenRecordset("QryHousingBenefit")
rst.MoveFirst
Set doc = MyWord.Documents.Open("C:\Documents and Settings\Compaq_Owner\My Documents\Dee\Houses\SET UP DOCS\Housing Benefit Authorisation Form May 2011.docx")
HAddress = rst!HouseAddress
HAddress1 = rst!HouseAddress1
TName = rst!TenantName
MRent = rst!MonthlyRent
MRent1 = rst!MonthlyRent1
Deposit = rst!Deposit
doc.Bookmarks("HouseAddress").Range.Text = HAddress
doc.Bookmarks("HouseAddress1").Range.Text = HAddress1
doc.Bookmarks("TenantName").Range.Text = TName
doc.Bookmarks("MonthlyRent").Range.Text = MRent
doc.Bookmarks("MonthlyRent1").Range.Text = MRent1
doc.Bookmarks("Deposit").Range.Text = Deposit
End Sub