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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill in MS Word fields based on name in access database

Status
Not open for further replies.

EdmCath

Technical User
Jun 22, 2004
34
CA
I am setting up a transmittal document in Word that would use an access database as its datasource. What I want to do is setup a combobox to reference the database and then based on my selection, fill in the address and other pertenant information. Is this possible? Also, I dont know if anyone here knows about AutoCAD, but is something like this possible in this program as well?

Any help on this is greatly appreciated.

Murray Johnson
Edmonton Catholic Schools
 
Create bookmarks in the word document on where your datasource would be entered. Save the document as a template (.dot)

I've created a form that pulls the pertinent information and a button that will load the info according to the word bookmarks. Microsoft Word 10.0 Object Library needs to be checked in the reference libarary. Following is the code for the on_click button:

Dim objWord As Object

Set objWord = New Word.Application

objWord.Documents.Add "Z:\WM_DB\BOL.dot" 'location of template file
objWord.Visible = True

If objWord.ActiveDocument.Bookmarks.Exists("date") = True Then
objWord.ActiveDocument.Bookmarks("date").Range.Text = Me!RECEIVE_DATE
End If

If objWord.ActiveDocument.Bookmarks.Exists("SO") = True Then
objWord.ActiveDocument.Bookmarks("SO").Range.Text = Me!SO_NO

"date" and "SO" are the bookmark names in the template
Me!RECEIVE_DATE and Me!SO_NO are the fields on the form
 
I'not quite sure I know what you are saying. Please forgive me but I'm relatively new to the whole code thing. What is the on_click button and is this in word or access? If it is in access, why would I want to click anything in access?

Any guidance would be great

Murray Johnson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top