Controlling db objects from VBA (like Database Window) ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Can anyone tell me if it it possible to programmatically control database
objects like the database window from VBA - I mean hide or show it, as well
as set the main menu to a special one at run time, and prevent the shortcut
menus being displayed depending on the result of a function that checks user
rights?

I know how to control the Startup behavior by using properties, but that
only works for the next time the db is opened.

Is there a way, on open, to hide and show the main db menu so myu custom one
can replace it, but only if a checkRights function returns false?

thanks for any help

Philip
 
Philip said:
Can anyone tell me if it it possible to programmatically control database
objects like the database window from VBA - I mean hide or show it, as well
as set the main menu to a special one at run time, and prevent the shortcut
menus being displayed depending on the result of a function that checks user
rights?

I know how to control the Startup behavior by using properties, but that
only works for the next time the db is opened.

Is there a way, on open, to hide and show the main db menu so myu custom one
can replace it, but only if a checkRights function returns false?


Us this kind of code in the startup form's Open event:

DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
and
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
 
Hi,

Thanks for that.

I tried to use 'DoCmd.RunCommand acCmdWindowhide' to hide the DB Window and
it workst great.

But when I try to use 'DoCmd.RunCommand acCmdWindowUnhide' to show the DB
Window the user is asked which window to unhide.

I can do it using SendKeys "{F11}" with no user interaction but is that the
only way to show the DB Window with no user interaction at all?

thanks

Philip
 
You should not use SendKeys because it can easily be sent to
a window other than the intended one.

Did you remember to select an object before trying to hide
the window?
 
Hi,

How do I select the appropriate object such as 'Database Window' ?

thanks for your help

Philip

Marshall Barton said:
You should not use SendKeys because it can easily be sent to
a window other than the intended one.

Did you remember to select an object before trying to hide
the window?
--
Marsh
MVP [MS Access]

I tried to use 'DoCmd.RunCommand acCmdWindowhide' to hide the DB Window and
it workst great.

But when I try to use 'DoCmd.RunCommand acCmdWindowUnhide' to show the DB
Window the user is asked which window to unhide.

I can do it using SendKeys "{F11}" with no user interaction but is that the
only way to show the DB Window with no user interaction at all?
 
Hi,

In fact I found the answer:DoCmd.SelectObject acForm, "", True
<<
will show the Database Window in 'Forms' view
DoCmd.SelectObject acTable, "", True
<<
will show the Database Window in 'Table' view

thanks anyway!

Philip
Marshall Barton said:
You should not use SendKeys because it can easily be sent to
a window other than the intended one.

Did you remember to select an object before trying to hide
the window?
--
Marsh
MVP [MS Access]

I tried to use 'DoCmd.RunCommand acCmdWindowhide' to hide the DB Window and
it workst great.

But when I try to use 'DoCmd.RunCommand acCmdWindowUnhide' to show the DB
Window the user is asked which window to unhide.

I can do it using SendKeys "{F11}" with no user interaction but is that the
only way to show the DB Window with no user interaction at all?
 
It's nice that you found it, especially since that's exactly
what I originally told you to use.
 
There is some of these settings, but why use any code?

You most certainly can, and should hide all of the ms-access interface. The
options to complete hide and keep people out of the ms-access interface can
easily be done using the tools->start-up options. Using those options allows
you to complete hide the ms-access interface (tool bars, database window
etc). Also, using these options means you
do not have to bother setting up security.

Try downloading and running the 3rd example at my following web site that
shows a hidden ms-access interface, and NO CODE is required to do
this....but just some settings in the start-up.

Check out:

http://www.members.shaw.ca/AlbertKallal/msaccess/DownLoad.htm

After you try the application, you can exit, and then re-load the
application, but hold down the shift key to by-pass the start-up options. If
want, you can even disable the shift key by pass. I have a sample mdb file
that will let you "set" the shift key bypass on any application you want.
You can get this at:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 
Back
Top