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"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
file = ActiveDocument.FullName
Set q = b.CreateQueryDef(""![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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
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