• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

Shift Bypass Emulation with VBA - Open database from another database like you were using the shift key

Is there a way to do this?  I have a database that I use to maintain other databases.  I would love to be able to open the other databases from it and bypass all the startup operations so that I can get in there and make changes quickly.
0
hollering
Asked:
hollering
  • 7
  • 6
1 Solution
 
jkorzCommented:
make an empty macro and make the command to launch your database (most likely using shell) in this format

the /x switch will execute the macro named instead of your autoexec, its like a nice little back door

pathtoaccess pathtodb /x youremptymacroname
0
 
jkorzCommented:
oops, I forgot to mention that you are going to need to modify your databases to include a macro named AutoExec that opens the form instead of setting it in startup properties... the /x switch only overrides a startup macro, not a startup form
0
 
holleringAuthor Commented:
Not a bad thought, however I usually do not use Autoexec macros, thus I have almost a hundred databases that have login and splash screen forms that perform all the prep work for my databases.  Your idea is good, but I'm not going to go into all those databases and get rid of the startup options and create an autoexec macro instead.  Thanks for the suggestion, maybe I'll implement this in any future databases if nothing better comes along.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
holleringAuthor Commented:
Haha...funny that you wrote that as I was writing my message.
0
 
jkorzCommented:
ok... I don't know what is wrong with me, but out of curiousity I tried my suggestion and it the /x switch DOESN'T override the start macro, so you can leave the form set in startup the way it is

my suggestion (it is a lame one, but it should work) is to make your empty macro not so empty and use it to close the form (I have tried this and it does work)

I know it's not as good as a shift+start but it is the only method I can figure out that will do what you are looking for

sorry for the brain farts

-jkorz
0
 
holleringAuthor Commented:
When you use the /x switch, does it execute that macro first thing?

I think you gave me an idea, but I won't have time to try it today.  I could write a macro that I could start using the /x switch.  The macro can set a global variable that will tell my opening form to do nothing except close itself and open the database window.  That is, assuming that the macro executes before the form_load code.
0
 
jkorzCommented:
I tested it out and the macro ran after the startup form loaded

if you want to do that, you will most likely be better off with the /cmd switch

here's the link to all the switches btw
http://support.microsoft.com/default.aspx?scid=kb;en-us;209207

you can then use the command() function to return anything that is after the /cmd switch in the command line... if the first thing your form loading code did was to check Command() for "DevMode" or something like that, you could have that close the form and quit everything...

I wouldn't have thought of that method until your last post, I think I am going to use that

this is not so roundabout... I feel much more comfortable recommending this one to ya

hope I helped

-Jkorz
0
 
holleringAuthor Commented:
I'm not sure I follow what you mean with the /cmd switch.  That's about the only switch I haven't used.  Can you give more detail as to how to do what you were saying?
0
 
jkorzCommented:
you launch the database with this:

pathtoaccess pathtodb /cmd devmode

in your form's load event you put this

If Command() = "devmode" Then
   cancel = 1
End if

simple enough?
0
 
holleringAuthor Commented:
Can't get it to work.
0
 
jkorzCommented:
oops, I made a mistake... you should put that code in the form's open event (the open event has cancel as an argument, load does not)

if that doesn't work, try doing this before the if statement

msgbox command()

if a blank message box comes up, make sure your command to launch access includes both the path to access (in quotes), the path to the database (in quotes) and /cmd devmode

0
 
holleringAuthor Commented:
Awesome...and not only have you solved a short-term problem, but you've given me knowledge of a feature that I'm sure I'll use again and again now that I know it exists.

Thanks a million...uhh...or....400 anyway  ;)
0
 
jkorzCommented:
glad I could help out
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now