E
Evan Morgoch
Hi everyone,
I'm sure there's a way to do this, I just don't know how.
Here is my situation:
I've been working with VBA and ADO to build a letter where
you enter a client's ID to a userform that pop up when you
open the letter, and it will use our oracle database to
complete the name & address information where needed. I
have now finished setting up a basic template to do this.
When the user clicks the button in the userfom that get
opened, I open an ADODB connection and connect to the
database, the do an SQL query to retrieve a recordset
object. I then take the recordset retrieved from the
database, and paste the information into the letter using
bookmarks, and close the userform. All the code for this
is contained in the commandbutton, under the
commandbutton_click() function.
Here's the problem now. We have about 100 different
letters that we send to our clients what I want to set up
using this code. From a set-up point, I have no problem
setting up each letter individually by copy and pasting
the code into each one and setting up the bookmarks, or
copying the contents of the letter into new documents
built from the base template with the VB code.
However, the maintance problem is something I'm concerned
with. Ideally, it would be nice if there was a way to set
up the letters so that, if any changes need to be made to
the code, I would only have to make the change in one
place, and it would be applied to all the letters. Would
basing all the letters on a single template, then (if need
be) editing the template achive this, or will there need
to be some other method that I need to use?
Also, I would like functionallity to expand this project
to retrive additional info, depending on the letter. This
would need to be letter specific info. The best I can
figure for this 'feature' would be to set up another sub-
routine in the template that takes that open connection
and the cilentID as parameters, but does not actually
perform any function in the template level. When I create
each of the letters, would add the code to the subroutine
to retrive and paste the necessary information. Would this
work?
Thanks for your input.
Evan Morgoch
I'm sure there's a way to do this, I just don't know how.
Here is my situation:
I've been working with VBA and ADO to build a letter where
you enter a client's ID to a userform that pop up when you
open the letter, and it will use our oracle database to
complete the name & address information where needed. I
have now finished setting up a basic template to do this.
When the user clicks the button in the userfom that get
opened, I open an ADODB connection and connect to the
database, the do an SQL query to retrieve a recordset
object. I then take the recordset retrieved from the
database, and paste the information into the letter using
bookmarks, and close the userform. All the code for this
is contained in the commandbutton, under the
commandbutton_click() function.
Here's the problem now. We have about 100 different
letters that we send to our clients what I want to set up
using this code. From a set-up point, I have no problem
setting up each letter individually by copy and pasting
the code into each one and setting up the bookmarks, or
copying the contents of the letter into new documents
built from the base template with the VB code.
However, the maintance problem is something I'm concerned
with. Ideally, it would be nice if there was a way to set
up the letters so that, if any changes need to be made to
the code, I would only have to make the change in one
place, and it would be applied to all the letters. Would
basing all the letters on a single template, then (if need
be) editing the template achive this, or will there need
to be some other method that I need to use?
Also, I would like functionallity to expand this project
to retrive additional info, depending on the letter. This
would need to be letter specific info. The best I can
figure for this 'feature' would be to set up another sub-
routine in the template that takes that open connection
and the cilentID as parameters, but does not actually
perform any function in the template level. When I create
each of the letters, would add the code to the subroutine
to retrive and paste the necessary information. Would this
work?
Thanks for your input.
Evan Morgoch