ProNetGroup
MIS
Hi,
The task that I am trying to accomplish is to have a search form in Access that creates a query on the fly (based on user selection) and then filters the results based on that query. Then, I need a button that can automatically open up the form letter template and do a mail merge based on the query that was made on the fly. This query is stored in a string variable, strSQL.
So far, I have been able to make it work to where it can print out the record that it is sitting on only (by creating a query in the database that shows only the record on the screen at the time) or all records in the whole table. I figure that there *should* be some way to pass on that query string to specify which records but I just can't seem to figure it out.
Also, currently I am using the Shell method to open Word and then open the template, but I was wondering if that was the best way. Based on all the postings on this web site, I also tried using objects to do it. I had it working for a while, and then I screwed it up so I bailed on that method until I figure it out fully. Also, after using the Shell to open word and the document, I called the macro that I had created in Word (I copied and pasted the Sub from Word VBA to Access VBA) and it ran fine for a while, but now it blows up on me, saying that the document isn't open.
Any suggestions on any of this? I know that this is alot, but I have spent almost 3 or 4 days trying to search the web site to figure out some of the answers to these questions and finally got frustrated and wrote my own.
Any help is GREATLY appreciated!!!!!
Thanks!
Eubanks
The task that I am trying to accomplish is to have a search form in Access that creates a query on the fly (based on user selection) and then filters the results based on that query. Then, I need a button that can automatically open up the form letter template and do a mail merge based on the query that was made on the fly. This query is stored in a string variable, strSQL.
So far, I have been able to make it work to where it can print out the record that it is sitting on only (by creating a query in the database that shows only the record on the screen at the time) or all records in the whole table. I figure that there *should* be some way to pass on that query string to specify which records but I just can't seem to figure it out.
Also, currently I am using the Shell method to open Word and then open the template, but I was wondering if that was the best way. Based on all the postings on this web site, I also tried using objects to do it. I had it working for a while, and then I screwed it up so I bailed on that method until I figure it out fully. Also, after using the Shell to open word and the document, I called the macro that I had created in Word (I copied and pasted the Sub from Word VBA to Access VBA) and it ran fine for a while, but now it blows up on me, saying that the document isn't open.
Any suggestions on any of this? I know that this is alot, but I have spent almost 3 or 4 days trying to search the web site to figure out some of the answers to these questions and finally got frustrated and wrote my own.
Any help is GREATLY appreciated!!!!!
Thanks!
Eubanks