Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Automation - Setting current record only 1

Status
Not open for further replies.

wbwillson

Technical User
Oct 7, 2002
52
GB
Hi,

I have a form which collects data which eventually gets sent to a Word document via bookmarks. I need to be able to send only the current record on my form to word. Currently if I have say 10 records in my table, when I generate the Word Doc it automatically goes to Record #1, but I'd like it to go directly to whatever record I happen to be on in my form.

I've tried setting the recordset like:

rstCust.RecordCount = [forms]![frmEmployees]![ID]

But this doesn't work. Any ideas would be greatly appreciated!

Bill
 
Answered my own question. Thanks anyway.

I used the following to pass just the form's current record to word using an On Click event.

Dim objWord As Word.Application

'Start Microsoft Word
Set objWord = createObject("Word.Application")

With objWord
'Make Word visible
.Visible = True

'Open the document
.Documents.Open ("C:\MyMerge.dot")

'Move to the bookmark and insert text from the form
.ActiveDocument.Bookmarks("First").Select
.Selection.Text = (CStr(Forms!Employees!FirstName))

End With

Maybe someone else will find this useful.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top