Blackshark
Programmer
Hi guys,
I have a database that creates jobs in our business applications. The code I use contains this at the top of the module:
Private KEASystem As KEA.System
Private KEASessions As KEA.sessions
Private KEASession As KEA.Session
Private KEAScreenn As KEA.Screen
When ever I want to use a terminal window to set up a job or run a report I use the following in a function:
Set KEASystem = CreateObject("KEA.System"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set KEASessions = KEASystem.sessions
Set KEASession = KEASessions.Item(Forms!Main!wmissessno)
Set KeaScreen = KEASession.Screen
It seems a little inefficient to have these two sets of code sitting all round by modules. What I would like to do is to have the databases main form (that is always open) create an instance of the four objects, set their parameters and then be able to use/refer to them in different forms/modules.
I have tried changing the declarations to Public but when I then change my code in other modules to:
Set Forms!Main(KEASystem) = CreateObject("KEA.System"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set Forms!Main(KEASession) = KEASystem.sessions
Set Forms!Main(KEASession) = KEASessions.Item(Forms!Main!wmissessno)
Set Forms!Main(KeaScreen) = KEASession.Screen
However I get an error when the code executes and I find that the KEASystem object is empty and does not support the function I am trying to execute.
So what am I doing wrong? I thought that maybe Static would come in to it somewhere but my head is sore and each time I try to get round the problem I end up hitting my head against a big brick wall.
Any assistance gratefully received.
Thanks Tim
I have a database that creates jobs in our business applications. The code I use contains this at the top of the module:
Private KEASystem As KEA.System
Private KEASessions As KEA.sessions
Private KEASession As KEA.Session
Private KEAScreenn As KEA.Screen
When ever I want to use a terminal window to set up a job or run a report I use the following in a function:
Set KEASystem = CreateObject("KEA.System"
Set KEASessions = KEASystem.sessions
Set KEASession = KEASessions.Item(Forms!Main!wmissessno)
Set KeaScreen = KEASession.Screen
It seems a little inefficient to have these two sets of code sitting all round by modules. What I would like to do is to have the databases main form (that is always open) create an instance of the four objects, set their parameters and then be able to use/refer to them in different forms/modules.
I have tried changing the declarations to Public but when I then change my code in other modules to:
Set Forms!Main(KEASystem) = CreateObject("KEA.System"
Set Forms!Main(KEASession) = KEASystem.sessions
Set Forms!Main(KEASession) = KEASessions.Item(Forms!Main!wmissessno)
Set Forms!Main(KeaScreen) = KEASession.Screen
However I get an error when the code executes and I find that the KEASystem object is empty and does not support the function I am trying to execute.
So what am I doing wrong? I thought that maybe Static would come in to it somewhere but my head is sore and each time I try to get round the problem I end up hitting my head against a big brick wall.
Any assistance gratefully received.
Thanks Tim