OpenCurrentDatabase with runtime environment

  • Thread starter DrAvi via AccessMonster.com
  • Start date
D

DrAvi via AccessMonster.com

Hello,

I have one Access application that has a command button that opens another
Access application.
It works great for me under full Office Access environment.

I’m trying to operate the same array with runtime for access 2007, and I keep
getting an error msg (“execution of this application has stopped due to a
runtime errorâ€) whenever I’m trying to open the other application using the
command button (the other application works fine when it’s being opened
manually).

I’m using the following VB code:
Dim Nacc As New Access.Application
Nacc.OpenCurrentDatabase "C:\SQLite\OpenSQLite.accdb", False,
"MyPassword"
Nacc.Visible = True

Do you have suggestions for how to solve this problem?

Regards,

DrAvi
 
D

david

This line won't work in the runtime version:
Dim Nacc As New Access.Application

It causes a runtime error.

In the runtime version, an unhandled runtime error will cause your
application to stop.

To have your application not stop, you can handle the runtime error:

on error goto catch:
Dim Nacc As New Access.Application

...

catch:
exit sub

To start a new runtime instance, you must give it a database
to open. Perhaps like this:

Dim NAcc as Access.Application

NAcc = GetObject("c:\dummy.accdb")

Nacc.OpenCurrentDatabase "C:\SQLite\OpenSQLite.accdb", False, "MyPassword"


(david)
 
D

DrAvi via AccessMonster.com

Hi David,

Thank you for the answer.

Well, I tried to use your suggestion, but it still doesn't work for me with
runtime for Access. Perhaps I'm doing something wrong, I don’t know.

Can you please write down the exact code, as I need to paste into my
application? – I want to see if the reason it's not working for me is because
wrongly using the code.

And, if there are other methods, I will appreciate for suggestions. I need an
advice so urgently and I have no idea where my mistake is…
 
P

PieterLinden via AccessMonster.com

DrAvi said:
Hi David,

Thank you for the answer.

Well, I tried to use your suggestion, but it still doesn't work for me with
runtime for Access. Perhaps I'm doing something wrong, I don’t know.

Can you please write down the exact code, as I need to paste into my
application? – I want to see if the reason it's not working for me is because
wrongly using the code.

The error handler generally goes like this...

Sub DoSomething()
On Error Goto ErrHandler

[variable declarations]

[procedure body]

Exit Sub ' end of processing/normal end of subroutine

ErrHandler:
'Error handling code goes here.
End Sub
 
D

david

I haven't got the runtime installed here, and I don't have the version of
Access you are using.

On what line do you have a problem.

You can't use

Dim Nacc As New Access.Application

You must use

Dim Nacc as Access.Application

Does that cause a problem?

You can't open the application without a database.
I think you need a database you can open without a password.
I think you need a dummy database you can open without a password.

I suggested
c:\dummy.accdb

Do you have a dummy database without a password? What is
it's name? Can you open it like this:

NAcc = GetObject("c:\dummy.accdb")

(david)
 
D

DrAvi via AccessMonster.com

Hi David,

Runtime for some reason can't even handle GetObject...

If someone ever tried a solution that work or have idea to one, please write
the code for it.

I also got an advice to use shell command to call the other password
protected Access application, but I don't really know how to use it… is that
a good hint to solve this issue? :)

DrAvi
 
D

david

What is the name of the database you are trying to open with GetObject.
Is it an empty database.
Where is it.
What is the error message you are getting when you try open an Empty
Database in a Trusted Location?

(david)
 
D

DrAvi via AccessMonster.com

The name and the root of the DB is: "C:\WorkMonitoring\SQlite.mdb"
It is functional DB and contains tables, Queries, forms and so forth.
While using runtime for Access, you get a general error msg "Execution of
this application has stopped due to a run_time_error. – The application can't
continue and will be shut down"

My a_d_d_r_e_s_s is dudidumi_*_g_m_a_i_l_*c_o_m
Can you please contact me, I will send you an example of the two mdb's (the
first that opens the other) that works fine under full Access, and crushes
under runtime? – Perhaps if you will see my VBA you will get up with some
idea for changes? (Do you have runtime on one of your machines for tests?)

What is the name of the database you are trying to open with GetObject.
Is it an empty database.
Where is it.
What is the error message you are getting when you try open an Empty
Database in a Trusted Location?

(david)
Hi David,
[quoted text clipped - 10 lines]
 
D

david

You need to open an empty dummy database first.




(david)




DrAvi via AccessMonster.com said:
The name and the root of the DB is: "C:\WorkMonitoring\SQlite.mdb"
It is functional DB and contains tables, Queries, forms and so forth.
While using runtime for Access, you get a general error msg "Execution of
this application has stopped due to a run_time_error. - The application
can't
continue and will be shut down"

My a_d_d_r_e_s_s is dudidumi_*_g_m_a_i_l_*c_o_m
Can you please contact me, I will send you an example of the two mdb's
(the
first that opens the other) that works fine under full Access, and crushes
under runtime? - Perhaps if you will see my VBA you will get up with some
idea for changes? (Do you have runtime on one of your machines for tests?)

What is the name of the database you are trying to open with GetObject.
Is it an empty database.
Where is it.
What is the error message you are getting when you try open an Empty
Database in a Trusted Location?

(david)
Hi David,
[quoted text clipped - 10 lines]
 
D

DrAvi via AccessMonster.com

Tried it - didn't work (What I did didn't work, perhaps i'm doing something
wrong).
Can you please contact me to my Email?

DrAvi


You need to open an empty dummy database first.

(david)
The name and the root of the DB is: "C:\WorkMonitoring\SQlite.mdb"
It is functional DB and contains tables, Queries, forms and so forth.
[quoted text clipped - 23 lines]
 
D

david

You need to report the error message, and the line number of the error,
rather than letting the run-time shut down.

(david)


DrAvi via AccessMonster.com said:
Tried it - didn't work (What I did didn't work, perhaps i'm doing
something
wrong).
Can you please contact me to my Email?

DrAvi


You need to open an empty dummy database first.

(david)
The name and the root of the DB is: "C:\WorkMonitoring\SQlite.mdb"
It is functional DB and contains tables, Queries, forms and so forth.
[quoted text clipped - 23 lines]
 

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