Bypass autoexec

G

Guest

Hello,

I would like to write some code that will open a database using the
OpenCurrentDatabase method. However the database I am opening has an
autoexec macro that opens a form.

My questions is how can I bypass the autoexec using the OpenCurrentDatabase
method?

Many thanks - this site is invaluable it really is.

Martin
 
G

Guest

Could you maybe explain exactly what you're tryin' to do? Why do you need to
open up the second DB... is it possible to just import the data directly
without running the DB? Or do you need to run a specific function or query in
that second DB? If you need to import data you should be able to do that
without even opening the second DB.
 
G

Guest

Hi,

I am deleting some forms and importing some new forms. That part I can do
but to do it I need to open the database and that is when the autoexec gets
in the way as the exec opens a form and runs some code.

Thanks,

Martin
 
G

Guest

Thanks Klatuu. I am am opening the database using code from another
database, I don't want to physically open the database itself.
 
G

Guest

That may be difficult in an external database. It can be done to the local
database in code (See AllowBypasskeys) in Access Help. Whether you can apply
this to an external database, I don't know. It would take some research and
testing to see if this will work.
 
R

RD

Hello,

I would like to write some code that will open a database using the
OpenCurrentDatabase method. However the database I am opening has an
autoexec macro that opens a form.

My questions is how can I bypass the autoexec using the OpenCurrentDatabase
method?

Many thanks - this site is invaluable it really is.

Martin

Take a look at this and see if it helps:
http://www.mvps.org/access/api/api0068.htm

Regards,
RD
 
D

David C. Holley

Why are you doing this programically? Typically, one of the purposes of
an Autoexec is to help discourage the modification of objects.
 
G

Guest

Thank you all.

I am bypassing the autoexec so I can update the forms. For everyone else I
want the autoexec to run on open.

I will try and get it working and copy the code to the replies if it works.

Thanks for your time once again.

Martin
 
D

David C. Holley

If its a matter of distributing new forms or objects, I would have the
DB with the autoexec handle copying the new objects. That way you don't
have to deal with bypassing the Autoexec. If you've got a split db, you
can set things up to have code check to see wether or not new objects
exist and if so which ones need to be copying. It might be as simple as
creating a table - tblNewObjects with a two fields - txtObjectName,
txtObjectType that lists the objects to copy.
 
G

Guest

David,

That sounds more like a solution than my work around. Can you give me some
hints on how I would set that up? Would I create a table with form name and
date of version, get access to check that version and then copy if
appropriate?

If I did have to copy would I have the same problem with the autoexec?

The autoexec checks the username and opens a form and copies files from the
server to the c temp folder. Most of the forms are sub forms in the main
switchboard, hidden until activated.

Thanks,

Martin
 

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