If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
HOWTO: Edit Report Code Programmatically
Our VB6 app makes use of an Access database report object that contains a
small amount of code. We are currently preparing an update exe for this app where one of the updates is a change to the code in the Access report. Since the user may have changed the design of the report, we do not want to overwrite the existing Access database when installing the update. Can anyone point me in the right direction for editing the code of an Access report using the Access object model? What I would like to do is access the report's code, then just overwrite all of the code with a stored string. Hopefully that makes sense... Thanks for any help! Dan |
#2
|
|||
|
|||
HOWTO: Edit Report Code Programmatically
Dan Johnson wrote:
Our VB6 app makes use of an Access database report object that contains a small amount of code. We are currently preparing an update exe for this app where one of the updates is a change to the code in the Access report. Since the user may have changed the design of the report, we do not want to overwrite the existing Access database when installing the update. Can anyone point me in the right direction for editing the code of an Access report using the Access object model? What I would like to do is access the report's code, then just overwrite all of the code with a stored string. Hopefully that makes sense... I think you need to use Automation to open the mdb file. Then you can Open the report in design view using DoCmd OpenForm. The report object's Module property's DeleteLines and InsertLines methods can be used to di what you want. Check VBA Help for the Module Object for details. -- Marsh MVP [MS Access] |
#3
|
|||
|
|||
HOWTO: Edit Report Code Programmatically
Thanks Marshall.
Do you have to add the Event Procedures separately using the CreateEventProc method (and then add the applicable lines to the procedure), or can I just create one string variable, containing text for both the event procedures headings and the related code lines within the procedure? Looks like I need to create the procedure, then add the lines to the procedure. Dan "Marshall Barton" wrote in message ... Dan Johnson wrote: Our VB6 app makes use of an Access database report object that contains a small amount of code. We are currently preparing an update exe for this app where one of the updates is a change to the code in the Access report. Since the user may have changed the design of the report, we do not want to overwrite the existing Access database when installing the update. Can anyone point me in the right direction for editing the code of an Access report using the Access object model? What I would like to do is access the report's code, then just overwrite all of the code with a stored string. Hopefully that makes sense... I think you need to use Automation to open the mdb file. Then you can Open the report in design view using DoCmd OpenForm. The report object's Module property's DeleteLines and InsertLines methods can be used to di what you want. Check VBA Help for the Module Object for details. -- Marsh MVP [MS Access] |
#4
|
|||
|
|||
HOWTO: Edit Report Code Programmatically
It's been awhile, but I think you can do the whole thing in
one shot. Try it on a test report and see what happens. -- Marsh MVP [MS Access] Dan Johnson wrote: Do you have to add the Event Procedures separately using the CreateEventProc method (and then add the applicable lines to the procedure), or can I just create one string variable, containing text for both the event procedures headings and the related code lines within the procedure? Looks like I need to create the procedure, then add the lines to the procedure. "Marshall Barton" wrote Dan Johnson wrote: Our VB6 app makes use of an Access database report object that contains a small amount of code. We are currently preparing an update exe for this app where one of the updates is a change to the code in the Access report. Since the user may have changed the design of the report, we do not want to overwrite the existing Access database when installing the update. Can anyone point me in the right direction for editing the code of an Access report using the Access object model? What I would like to do is access the report's code, then just overwrite all of the code with a stored string. Hopefully that makes sense... I think you need to use Automation to open the mdb file. Then you can Open the report in design view using DoCmd OpenForm. The report object's Module property's DeleteLines and InsertLines methods can be used to di what you want. Check VBA Help for the Module Object for details. |
Thread Tools | |
Display Modes | |
|
|