Printing from another database

simongallop

Registered User.
Local time
Today, 20:45
Joined
Oct 17, 2000
Messages
611
I have a database that keeps control (MAIN.MDB) and is the user interface of about 200 other databases. These other databases can also be used manually

Reducing the problem to 2 database. MAIN and SLAVE. SLAVE is a database that creates reports with 1 form which allows the user to choose which month to run (default present month) if a manual run is necessary.

I need to be able to print a report from SLAVE with the request coming from MAIN. The catch is that the report takes a date from the form in SLAVE.

If I get code to open the database, fill the textbox with the required date and then open the report which defaults to print, the code will pause upon opening the form.

If I add a function within SLAVE and call it from MAIN, thus removing the need to open the form, it means that I have to add the ProjectName to the references within MAIN. This means that whenever MAIN is open it has a .ldb open with SLAVE. Multiply by 200 and I am guessing that it reduces the performance of MAIN.

Is there a way of either calling code in another db without adding to References, or remotely filling a textbox without losing control when opening the form?

I hope that I am making sense

Thanks in advance

Simon
 
I don't know if I am getting you right but I think you may be able to get round it if you write the date returned from the function to a .txt file location and thus not need to link the SLAVE and MAIN project references.

You could then call this info written from SLAVE into MAIN rather than using a direct pass.

I'm not sure of the implication of calling info from text files and how the best way to pass dates would be but it may be worth consideration.

Ian
 
Ian thanks for your reply. I didn't explain myself well enough.

The Databases:
MAIN This database records actions done within customer databases, as well as keeping customer details.

SLAVE This is one of the (200 or so) customer databases. It is used to run monthly reports. It is usually launched from a timer and creates and prints reports. At the end of its autorun process, it writes data to MAIN to say that the reports have been printed.

I am trying to allow the user to request a reprint. This would be done by selecting a report and the relevant month within MAIN. The procedure within MAIN would then find the correct SLAVE database, open it, pass the date of the month that is needed and the name of the report, print said report and close the database.

At present either I need to declare a SLAVE print sub within MAIN which creates and ldb (multiply by 200...=slow system) or I can use the RUN command.

So far with RUN command, I can open SLAVE, pass the date and print the report, but when the SLAVE code has finished it does not pass the focus back to MAIN which means that SLAVE stays open. If I use Application.Quit at the end of the SLAVE code, then it crashes because MAIN is looking for the Automation Application.

Very verbose description, I know, but how do I pass control BACK from something that has been opened through code so that I can in turn close it?
 
That does sound a bit beyond me! Sorry...
Any other takers..
 
This is the method I use to automate printing reports in a Slave.mdb using Master.mdb:

1.A form "PrintReports" in Slave.mdb has a timer event which prints the desired reports and when done, closes Slave.mdb.

2. Code in Master.mdb changes the startup form in Slave.mdb to "PrintReports".

3. The timer event on PrintReports also resets the startup form in Slave.mdb back to the user's normal startup form.

Hope this helps. I can provide more details if this sounds like it will help. Good luck!
 
Simon,

This may be off track since I'm not real clear on your process.

Perhaps the way to pass information back and forth between 2 databases is:
create a third intermediate database.

Let the Slave write to the interm database when it has finished its work. The Slave would insert a record with the report it made and the Month it used. Then the Master can look at the interm database to see what the Slave has done and invoke the Slave to do a reprint.

Hope that makes some sense.

RichM
 

Users who are viewing this thread

Back
Top Bottom