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

Event passing between 2 access apps

Status
Not open for further replies.

Sawatzky

Programmer
Dec 13, 2000
283
DE
Dear all,

I would like to pass Events between 2 independent access-applications.
I have an access-frontend that let the user select data for a printout.
the printout itself is done by the access-middleware(which itself gets its data from sql-server)

Now I do not want to call a procedure of the middleware from the frontend , as this would cause the front end to wait for the middleware, but I want to send a parametrized Event to the middleware.

The question is how to declare a global Event for the middlewar and how to raise it from the frontend.

Any help and ideas appriciated.
(also a cool way to do the same without events would be welcome)

Thanks in advance

regards Astrid
 
Place a table in the 'middleware' app. Have 'something' in the middleware app check the table on a regular basis (timer?) and respond.

On a broader theme, why do you feel it is necessary or even useful to have the third layer? And, giventhat you DO have the middlle tier, why NOT simply call a procedure in it?

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
dear michael,

I have in between place a class in the middleware which has events that can be risen via a procedure call. At the moment it raises the events but annoyes me , with opening a module in debug-mode (step by step) rather than executing it. (there must be some stupid thing I will find in my code somewhere.)
and I still wonder, if there is a way to declare an event globally for an appliation


I can't have a timer as the middleware is only called by the frontend. So the middleware is not opened until it is needed by the frontend.

I have to use the 3-tier model in fact because of specifications given. ( the client is the natural enemy of a programmer)

regards astrid





 
" ... it raises the events but annoyes me , with opening a module in debug-mode ... "

This is not the nnorm for 'referenced' modules, so either you are invoking it in some other process or there is some problem there. Since you stated that you do NOT want to call the middleware procedure from the 'front end', it appear that you have found SOME other mechanisim to invoke it. I would like to know/understand this process.

" ... I still wonder, if there is a way to declare an event globally for an appliation ... "

In your inital post, you were asking about an event SHARED between two seperate apps.

AFAIK, this would need to be an API call. Something like a message. I do not exercise the API enough to know the specific API's -but I do know that you can find the handle of a RUNNING app and post messages to it. Again, I'm a bit confused as to the rols of the middleware app. You state (imply?) it is an Ms. Access app, but that it is not 'running' (" ... until opened by the front end ..."), but Ms. Access would need to be running when the procesure is invoked.

If you are instantiating the second copy of Ms. Access through code in the Front end? You could start it (middleware app) with a command line option for the startup form. Set the start up form to run your procedure. If you need parameters, do the linked table thing and place the args in the table.

Aparently more going on here than meets the eye.

" ... I have to use the 3-tier model in fact because of specifications given."

This could be the real heart of the problem. go back to the 'client' and discuss what the specification is intended to accomplish. If the functional goal is not reasonable or pratical you need to explain the process more clearly and show that the spec requirement is not accomplishing either what they want or anything useful.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Dear michael,

1)
at the moment the frontend instanciates the middleware with createobject, calls a procedure in the middleware which initializes a class in the middleware and then the procedure calls a method of the class, which raises the event of the class.

sounds confused , but works, so far. except of that debug-mode thing.

2) I did not mean 1 event shared, but somehow let the frontend raise an event in the middleware so that my frontend can work on while the middleware does the stuff it should do. when the middleware has done it should raise another event in the frontend telling about success or failure.


3)
how is the commandline option thing done?

regards astrid


 
See the bolded items in the following.

Startup command-line options
The following table lists the Microsoft Access command-line options.

Option Effect Applies To
database Opens the specified Microsoft Access database or Microsoft Access project. Include a path if necessary. If you are running Microsoft Windows 95, the default path is your My Documents folder. Access database or Access project
/excl Opens the specified Access database for exclusive access. To open the database for shared access in a multiuser environment, omit this option. Access database only
/ro Opens the specified Access database or Access project for read-only access. Access database or Access project
/user user name Starts Microsoft Access by using the specified user name. Access database only
/pwd password Starts Microsoft Access by using the specified password. Access database only
/profile user profile Starts Microsoft Access by using the options in the specified user profile instead of the standard Windows Registry settings created when you installed Microsoft Access. This replaces the /ini option used in versions of Microsoft Access prior to Access 97 to specify an initialization file. Access database or Access project
/compact target database or target Access project Compacts and repairs the Access database, or compacts the Access project that was specified before the /compact option, and then closes Microsoft Access. If you omit a target file name following the /compact option, the file is compacted to the original name and folder. To compact to a different name, specify a target file. If you don't include a path in target database or target Access project, the target file is created in your My Documents folder by default.
In an Access project, this option compacts the Access project (.adp) file but not the Microsoft SQL Server database.
Access database or Access project
/repair Repairs the Access database that was specified before the /repair option, and then closes Microsoft Access.
In Microsoft Access 2000, compact and repair functionality is combined under /compact. The /repair option is supported for backward compatibility.
Access database only
/convert target database Converts a previous-version Access database to an Access 2000 database with a new name, and then closes Microsoft Access. You must specify the source database before you use the /convert option. Access database only


/x macro Starts Microsoft Access and runs the specified macro. Another way to run a macro when you open a database is to use an AutoExec macro. Access database or Access project


/cmd Specifies that what follows on the command line is the value that will be returned by the Command function. This option must be the last option on the command line. You can use a semicolon (;) as an alternative to /cmd.
For information on the Command function, click .
Access database or Access project
/nostartup Starts Microsoft Access without displaying the startup dialog box (the second dialog box that you see when you start Microsoft Access). Access database or Access project
/wrkgrp workgroup
information file Starts Microsoft Access by using the specified workgroup information file. Access database only


Notes


To run a Visual Basic for Applications procedure when you open a database, use the RunCode action in the AutoExec macro or in the macro that you run by using the command-line option /x. You can also run a Visual Basic procedure when you open a database by creating a form with a Visual Basic procedure defined for its OnOpen event. Designate this form as the startup form by right-clicking the Database window, clicking Startup, and then entering that form in the Display Form/Page box.



MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
P.S. for the Return Notification - in your set up- I would still use the shared / linked table. The fromt end would "Set" some value into the table, and the middleware app would clear / reset it. The Front end would need to poll the table to check the completion status.

On the other hand, the overall effect of this convolouted attempt to have the middleware app is not any different than just having the Frontend either reference the middleware code, or -more realistically- just incorporate the whole process into the FrontEnd. To truly use middleware you need to have COM or DCom objects, which (AFAIK), you cannot make with Ms. Access.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Dear michael,

TFI, I gonna dig into it. Seems I 'm thinking more complicated than I should.

regards Astrid
 
Dear michael,

I've got it working.
1)
I have a public procedure with parameters in a module in the middleware that instanciate a class in middleware called Frame.
I have a public parameterized method in frame that instanciates the worker class (for printout) and passes the parameters and raises the event. this event is caught and starts print out.
And the front end works on as wished.
2)
Opening in debug-mode was caused by a debug halt point, that was still referenced by VBA even though I removed it.
After re-compiling the project VBA removed it too.
(seems to be a bug in VBA)

Thanks for all your help and time

regards Astrid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top