Programmatically bypass startup options like holding Shift key

M

mike.michelle

Hello,

I'm working on a VB.Net app that tries to open Access (mdb) files, and
I don't want any user interaction.

I'm having trouble with databases that have a startup form set, which
in turn has links to sources that aren't available - these cause
message boxes to appear.

However, I can prevent this by holding down the Shift key when manually
opening the database.

Is there a way to do this programmatically?

Thanks
Mike
 
6

'69 Camaro

Hi, Mike.
Is there a way to do this programmatically?

Yes. As long as the AllowBypass Key hasn't been disabled, you can use the
Windows API to programmatically press the <SHIFT> key. Sample VBA code is
available on the following Web page, but you'll have to convert it to
VB.Net:

http://www.mvps.org/access/api/api0068.htm

Within the fGetRefNoAutoexec( ) function, you can write your code that you
need to automate the database, or even call a local procedure to run right
after the database is opened. For example:

' Open a mdb with Autoexec
Call .OpenCurrentDatabase(strMDBPath, False)

' Do whatever in this section to automate the remote DB.
Call mySub

' Revert back keyboard state
Call SetKeyboardState(abytCodesSrc(0))

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

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