Display database window

G

Guest

How can I detect programmatically if the mdb file was open with database
window visible or hide?

Thanks
jcp
 
6

'69 Camaro

Hi, Jose.
How can I detect programmatically if the mdb file was open with database
window visible or hide?

One cannot check whether the file opened with the Database Window visible or
not. One can only check what the current setting is after the file is
opened. In the Immediate Window, paste the following code:

? CurrentDb().Properties("StartUpShowDBWindow").Value

If the result is TRUE, then the Database Window will be visible next time
the database is opened. If the result is FALSE, then Database Window will
be hidden next time the database is opened. Keep in mind that the setting
can be changed by the user before the database is closed, so it's not set in
stone.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

I tested but something is wrong, always the result is 0 (false)
I used currentproject.Properties("StartUpShowDBWindow").Value because I'm
working with adp.

I need this because I have a MenuRpt form should be keep always open.
I get help from froms.coding group to use an event on unload.
I did, it works but I have a problem. If I open it, off course I can't close
this is what I want, but I can't go to design view.
The database is not finish, I'm working with it.
That's why I need detect if database was open with database window visible
or not to add the result to the event on unload.

I don't why, the result always is 0.
 
G

Guest

I check my adp and the result always is 0 because in tools menu/startup I set
false.
If I want to open the database to do modifications I need to press shift F11.

Question
How can I know if I open the database pressing shift F11? (database
window=true)

Thanks
 
6

'69 Camaro

Hi, Jose.
I tested but something is wrong, always the result is 0 (false)
I used currentproject.Properties("StartUpShowDBWindow").Value because I'm
working with adp.

That means that the current startup setting has the "Display Database
Window" unchecked. Select the Tools -> Startup... menu to open the Startup
dialog window and mark the "Display Database Window" check box, then press
the "OK" button to save the change. When you check its value in the
Immediate window, you'll see that the result is TRUE (-1).

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
6

'69 Camaro

Hi, Jose.
I check my adp and the result always is 0 because in tools menu/startup I
set
false.
Correct.

How can I know if I open the database pressing shift F11? (database
window=true)

Immediately after opening the dataabse, the Database Window and all default
CommandBars will be displayed, and no startup form (if there is one) will be
open. The AutoExec macro (if there is one) will not run, either.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

My adp doesn't have startup form. I have a macro.
So if I open the database and don't press F11 macro runs, configure startup
settings and open a splash form.

If I press shift F11 ignore macro and window database is visible. But if I
go menu bar tools and then startup, display database window is clear.
That's why I ask if is possible to detect if database was open pressing
shift F11.

The method, CurrentDb().Properties("StartUpShowDBWindow").Value doesn't work
because display database window is clear
Do you have any idea to detect if database was open shif F11 or not

Thanks
 
6

'69 Camaro

Hi, Jose.
The method, CurrentDb().Properties("StartUpShowDBWindow").Value doesn't
work
because display database window is clear

If it returns a value, even if that value is FALSE or 0, then it's showing
what the setting is -- without you having to manually look in the Startup
dialog window to check the setting.
Do you have any idea to detect if database was open shif F11 or not

There's no way for the database being opened to determine whether it was
opened with the <SHIFT> key, because no VBA code runs when the <SHIFT> key
opens the database. However, you can have a startup form or AutoExec macro
run at start up that executes a custom VBA function that signals that the
database was _not_ opened with the <SHIFT> key during the current session.
That signal could be a value saved in a table, or a value set in a text box
on a hidden form so that the user can't see it, or a custom database
property could be set, et cetera. I don't recommend setting a global
variable, because global variables get reset as soon as an error occurs.

You can create an AutoKey for <F11> that will execute instead of the
built-in <F11> functionality, and have that AutoKey macro first display the
Database Window and then execute a custom VBA function that signals that
<F11> was pressed.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

When I said last chance, I mean I will stop asking you help because I feel
you are spend lot of time for me.
Thanks a lot
jcp
 
6

'69 Camaro

Hi, Jose.
There is way to detect if F11 is enable or not?

Use the AllowSpecialKeys Database Property to determine whether or not the
"Use Access Special Keys" check box is marked in the Startup dialog window.

CurrentDb().Properties("AllowSpecialKeys").Value

or:

CurrentProject.Properties("AllowSpecialKeys").Value

If the value is TRUE (or -1) then the check box is marked. If the value is
FALSE (or 0) then it's unmarked.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Hi Camaro,
Thanks a lot for your time.
This method I did before and doesn't work because the result is the same.

Tools/Startup/use special keys is clear. So using this method the result is
the same, false. This is because this method will detect the status in
tools/startup. Is it correct?

Once we can not detect if we hold shift, I was trying the following think.

If the user open the database from shortcut, the macro autoexec run and F11
is disable, then the result is false
If the programmer (myself) open holding shift, F11 is enabled, then the
result is true.
That’s why I ask if is possible to detect if F11 is disable or enabled.

I appreciate a lot your help.
Regards
jcp
 

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