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

Need to build Modules on the fly in Access97 - How do I do that

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Client has an old process that updates data by emulating terminal input. There is not other way to interface with the product. You can record scripts and run them but they are very limiting (forward referencing, limited pathing, etc).

I have been digging around in the online help and finally found an object model and have successfully instantiated an object from Access. From within Access, I have logged onto the system and progressed to the place where the actual screen emulation begins.

If I was an employee, I would save the generated scripts as modules in an Access file and call them, but that isn't an option. The gal I am doing the project for is technically capable but doesn't like to program so anything I do must be very highly automated.

I would like them to save their scripts as they normally do only as text files instead. Then I would like Access to pick up the appropriate one and build a module on the fly and execute it from Access automation. That way I can get around all of the restrictions of kicking off a script.

Has anyone done anything like this? Any ideas or suggestions would be greatly appreciated!

Have a great day!
 
some confusion / difficulty here. you can, of course, use the modules and lines collections / documents to manipulate the content of modules, including inserting and deleting lines of 'code'. Unfortunatly, you need to do this with 'programs' (procedures) which are vb(a) code - which you say you cannot implement in the" customer's " program. You then go on to note that the customer doesn't like (want?) to program - but builds scripts all the time, This seems a bit contradictory, as "scripts" are generally just programs of a different 'stripe'. The "scripts" particularly ones which are saved and which aparently also call other scripts are as much "programming" as any language. It would appear that the scripts are even vbScrip programs, otherwise the conversion to Ms. A. / VBA would be quite a challenge.

'Between the lines' of all of the confusion sown and reaped in the wending through the mire, suddenly (or not so suddenly), appears the thought that if the 'app' is some legacy thing which cannot be ammended, perhaps the better approach (and opportunity) would be to just re design and implement the functionallity is some form which CAN be 'modernized ' (MS Access anyone?).


MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
MichaelRed - good points. Feels like this is more to do with client-education than technical fixes (i.e. the real problem at the client site is somewhere between the chair and the keyboard).

Buckeye - if the client is absolutetly entrenched in their position and you end up having to construct code on the fly, the following article should point you in the right direction.

 
Neal and Michael,

Thanks for the help and suggestions. I know how to do all of the things in the Microsoft link. Hopefully this will help to clarify what I would like to do.

1. The app is a legacy Hospital billing system which isn't going to be rewritten.

2. Creating a script involves logging onto a session and turning on a Macro recorder much like you do in Excel. It generates, essentially, VB code which is saved in a semi compiled state.

3. To run the script, you logon to a session, select Run Script and use a Windows style file browser to find the file you want to run. When a file is selected it is run.
Then the user logs off.

4. They would like to automate the process to run unattended in the early morning hours. Access can use the exposed RunScript method to kick off the script.

If I copy the script into a module, I can run it as is once I have set a reference to the application object. The client people are not going to do that. If I can create a module on the fly then they don't have to do it and it will run better.

But, if I create a module on the fly, it cancels all of my project settings for the open project. It seems like it resets everything. Am I way off base here? If it is not readily doable, perhaps I need to just forget that part and go on.

Thanks again for the responses!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top