calling functions

D

dave

Hi
I am building one application in ms access 2003.
what basically does is it execute some function of other database. to achieve this i had put all functions in startup of other database...
(i.e. function is called in form loading event and form is setup as startup object)
logic is something like this in main application..

while 'schedular is not finished
'execute statement 1

'below things will open the other database and it will execute all function in start up event

Shell "C:\Program Files\Microsoft Office\Office11\msaccess.exe C:\PR\db1\PRCOPY.mdb", vbNormalFocus

statement 2
statement 3

wend

i m getting two problem with this..

first is its execute statement2 even the above statement execution (executing function of other database) is not finished...i want to stop execution of prog until it finsih it..
second is all variable are goes out of scope once it start executing other database..

can any one suggest me how to handle this thing? i cant merge other database function in my main application..
any help would be appreciated..
thanx in advance
dave
 
M

Michel Walsh

Hi,


For the first problem, you can use WaitForSingleObject
(http://support.microsoft.com/default.aspx?scid=kb;en-us;178116).


For the second problem, processes are isolated, so one can crash, without
crashing the others. There are possibilities of inter-processes
communication, though, such as Windows message, DCOM, file (on hard disk or
in memory),... and data in database. .


Hoping it may help,
Vanderghast, Access MVP



Hi
I am building one application in ms access 2003.
what basically does is it execute some function of other database. to
achieve this i had put all functions in startup of other database...
(i.e. function is called in form loading event and form is setup as startup
object)
logic is something like this in main application..

while 'schedular is not finished
'execute statement 1

'below things will open the other database and it will execute all
function in start up event

Shell "C:\Program Files\Microsoft Office\Office11\msaccess.exe
C:\PR\db1\PRCOPY.mdb", vbNormalFocus

statement 2
statement 3

wend

i m getting two problem with this..

first is its execute statement2 even the above statement execution
(executing function of other database) is not finished...i want to stop
execution of prog until it finsih it..
second is all variable are goes out of scope once it start executing other
database..

can any one suggest me how to handle this thing? i cant merge other database
function in my main application..
any help would be appreciated..
thanx in advance
dave
 
D

dave

Thanx Michel
Your suggested solution really worked.
But only problem now is its raise Err.number 91 when shell command executed
and I think that variable goes out of context.
Any suggestion
Thanx again
dave
 
D

dave

Hi Michel

One more strang thing that if you execute function by passing value it
works...but if you store value in variable and call the function it doesnt
work..

'This code doesnt work...
MyStr = "C:\PR\db1\PRCOPY.mdb"
StrPath = "C:\Program Files\Microsoft
Office\Office11\msaccess.exe " & MyStr
MsgBox Eval(StrPath)
ExecCmd Eval(StrPath)
'This code works
ExecCmd "C:\Program Files\Microsoft
Office\Office11\msaccess.exe C:\PR\db1\PRCOPY.mdb"
ExecCmd Eval(StrPath)

Any idea..
This prob driving me crazy...
Thanx
dave
 
M

Michel Walsh

Hi,


I suspect, at first glance, a problem of space. If, in a command window,
you type

a b


it understand to run application (command) name a, with argument b. So, with

C:\Program Files


as example, you try to run an application Program with the argument Files.
If the path name has space, in such case, you can try to use " " :

"C:\Program Files\ApplicationA" argument


which, written in a string, becomes

Dim str As String
str = """C:\Program Files\ApplicationA"" argument"





Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top