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

Controlling Access XP from Word

Status
Not open for further replies.

norriz

Programmer
Jan 13, 2003
1
US
I am trying to open a MS Word Mailmerge Document from within access, then allow the user to change the word document have it save as under another name, and then have access open again, and know the location of the new file.


I have been able to open the merge document correctly. What I intended to do was put some code on the onclose event of the word document that would append a table in my access database with its name and description. Then when my form in access was opened again it would query that table to see if a new file was created.

The problem is I cant get the code right for appending the table in access from word. I thought the code was

Dim b As Database
dim q as variant

Set b = OpenDatabase("the path of my database.mdb")
file = ActiveDocument.FullName
Set q = b.CreateQueryDef("")
q.SQL = "Insert into Letters (letters.laddress, letters.ldesc) Select '" & file & "' As address, Temp as description"
q.Execute

with this code i get an error on the last line. Saying too few paramaters. NOw I know this code would work in access. So is my approach wrong, or is the code different in word or what? I appreciate your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top