Show Query Design Toolbar

L

Larry

I am starting my database with the database window and built-in
toolbars hidden. Certain people have the right to created new queries,
so I have created a button (which is visible only for these people)
that will display the database window so they can access queries.

The problem is the Query Design Toolbar is not displayed when they go
into Design view. I have tried to show the toolbar using the following
statement, without success:
---DoCmd.ShowToolbar "Query Design", acToolbarYes

I have tried putting this statement before and after the statement
that opens the database window, and it still doesn't show the toolbar.

So now I've tried to set the toolbar option to allow built-in toolbars
first, but that doesn't help either. My current code looks like the
following, so can anyone tell me what I missed or need to change?

Application.SetOption "Built-In Toolbars Available", True
DoCmd.ShowToolbar "Query Design", acToolbarYes
DoCmd.SelectObject acQuery, "", True
 
L

Larry

I am starting my database with the database window and built-in
toolbars hidden. Certain people have the right to created new queries,
so I have created a button (which is visible only for these people)
that will display the database window so they can access queries.

The problem is the Query Design Toolbar is not displayed when they go
into Design view. I have tried to show the toolbar using the following
statement, without success:
---DoCmd.ShowToolbar "Query Design", acToolbarYes

I have tried putting this statement before and after the statement
that opens the database window, and it still doesn't show the toolbar.

So now I've tried to set the toolbar option to allow built-in toolbars
first, but that doesn't help either. My current code looks like the
following, so can anyone tell me what I missed or need to change?

Application.SetOption "Built-In Toolbars Available", True
DoCmd.ShowToolbar "Query Design", acToolbarYes
DoCmd.SelectObject acQuery, "", True

WOW, no one has any suggestions? I didn't think this was that hard to
do, but I guess I was wrong! :(
 
M

M Skabialka

I query the username of the person logged on

UserName = Environ("UserName") 'fOSUserName

and based on their AccessLevel (stored in a table) use this code:

If rs![AccessLevel] < 5 Then
DoCmd.ShowToolbar "Form Design", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Report Design", acToolbarNo
Forms![frmMainMenu]![Administration Menu].Visible = False
Forms![frmMainMenu]!DeleteButton.Visible = False
Else
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
Forms![frmMainMenu]![Administration Menu].Visible = True
Forms![frmMainMenu]!DeleteButton.Visible = True
End If

This is in the startup form among the first code that runs. In fact this
form remains invisible to the users at all times.

This may or not be relevant to your dB, but works well for mine!
Mich
 
L

Larry

This is SO frustrating!

I understand your code and implemented something similar, but the toolbars
do NOT vanish! I have the following code and for those that are not
authorized, only the Menu bar vanishes, the toolbars stay there regardless.
Any ideas (btw, it's Access 2003)???

gblnAuthorized = Authorized(GetUserID())

If gblnAuthorized Then
intToolbar = acToolbarWhereApprop
Else
intToolbar = acToolbarNo
End If

DoCmd.ShowToolbar "Form Design", intToolbar
DoCmd.ShowToolbar "Menu Bar", intToolbar
DoCmd.ShowToolbar "Table Datasheet", intToolbar
DoCmd.ShowToolbar "Report Design", intToolbar
DoCmd.ShowToolbar "Query Design", intToolbar


M Skabialka said:
I query the username of the person logged on

UserName = Environ("UserName") 'fOSUserName

and based on their AccessLevel (stored in a table) use this code:

If rs![AccessLevel] < 5 Then
DoCmd.ShowToolbar "Form Design", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Report Design", acToolbarNo
Forms![frmMainMenu]![Administration Menu].Visible = False
Forms![frmMainMenu]!DeleteButton.Visible = False
Else
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
Forms![frmMainMenu]![Administration Menu].Visible = True
Forms![frmMainMenu]!DeleteButton.Visible = True
End If

This is in the startup form among the first code that runs. In fact this
form remains invisible to the users at all times.

This may or not be relevant to your dB, but works well for mine!
Mich


Larry said:
WOW, no one has any suggestions? I didn't think this was that hard to
do, but I guess I was wrong! :(
 
M

M Skabialka

Are you sure gblnAuthorized is getting initialized properly and returning
the true or false you expect?

Larry said:
This is SO frustrating!

I understand your code and implemented something similar, but the toolbars
do NOT vanish! I have the following code and for those that are not
authorized, only the Menu bar vanishes, the toolbars stay there
regardless.
Any ideas (btw, it's Access 2003)???

gblnAuthorized = Authorized(GetUserID())

If gblnAuthorized Then
intToolbar = acToolbarWhereApprop
Else
intToolbar = acToolbarNo
End If

DoCmd.ShowToolbar "Form Design", intToolbar
DoCmd.ShowToolbar "Menu Bar", intToolbar
DoCmd.ShowToolbar "Table Datasheet", intToolbar
DoCmd.ShowToolbar "Report Design", intToolbar
DoCmd.ShowToolbar "Query Design", intToolbar


M Skabialka said:
I query the username of the person logged on

UserName = Environ("UserName") 'fOSUserName

and based on their AccessLevel (stored in a table) use this code:

If rs![AccessLevel] < 5 Then
DoCmd.ShowToolbar "Form Design", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Report Design", acToolbarNo
Forms![frmMainMenu]![Administration Menu].Visible = False
Forms![frmMainMenu]!DeleteButton.Visible = False
Else
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
Forms![frmMainMenu]![Administration Menu].Visible = True
Forms![frmMainMenu]!DeleteButton.Visible = True
End If

This is in the startup form among the first code that runs. In fact this
form remains invisible to the users at all times.

This may or not be relevant to your dB, but works well for mine!
Mich


Larry said:
I am starting my database with the database window and built-in
toolbars hidden. Certain people have the right to created new queries,
so I have created a button (which is visible only for these people)
that will display the database window so they can access queries.

The problem is the Query Design Toolbar is not displayed when they go
into Design view. I have tried to show the toolbar using the following
statement, without success:
---DoCmd.ShowToolbar "Query Design", acToolbarYes

I have tried putting this statement before and after the statement
that opens the database window, and it still doesn't show the toolbar.

So now I've tried to set the toolbar option to allow built-in toolbars
first, but that doesn't help either. My current code looks like the
following, so can anyone tell me what I missed or need to change?

Application.SetOption "Built-In Toolbars Available", True
DoCmd.ShowToolbar "Query Design", acToolbarYes
DoCmd.SelectObject acQuery, "", True

WOW, no one has any suggestions? I didn't think this was that hard to
do, but I guess I was wrong! :(
 
L

Larry

Yes. I have done a Debug.Print on the value AND it is the value I use to
enable the form for write access as well. If it's not enabled, there are
several buttons hidden and such, and all that is working fine.

It's just the toolbars that are not working.

M Skabialka said:
Are you sure gblnAuthorized is getting initialized properly and returning
the true or false you expect?

Larry said:
This is SO frustrating!

I understand your code and implemented something similar, but the toolbars
do NOT vanish! I have the following code and for those that are not
authorized, only the Menu bar vanishes, the toolbars stay there
regardless.
Any ideas (btw, it's Access 2003)???

gblnAuthorized = Authorized(GetUserID())

If gblnAuthorized Then
intToolbar = acToolbarWhereApprop
Else
intToolbar = acToolbarNo
End If

DoCmd.ShowToolbar "Form Design", intToolbar
DoCmd.ShowToolbar "Menu Bar", intToolbar
DoCmd.ShowToolbar "Table Datasheet", intToolbar
DoCmd.ShowToolbar "Report Design", intToolbar
DoCmd.ShowToolbar "Query Design", intToolbar


M Skabialka said:
I query the username of the person logged on

UserName = Environ("UserName") 'fOSUserName

and based on their AccessLevel (stored in a table) use this code:

If rs![AccessLevel] < 5 Then
DoCmd.ShowToolbar "Form Design", acToolbarNo
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
DoCmd.ShowToolbar "Table Datasheet", acToolbarNo
DoCmd.ShowToolbar "Report Design", acToolbarNo
Forms![frmMainMenu]![Administration Menu].Visible = False
Forms![frmMainMenu]!DeleteButton.Visible = False
Else
DoCmd.ShowToolbar "Menu Bar", acToolbarYes
Forms![frmMainMenu]![Administration Menu].Visible = True
Forms![frmMainMenu]!DeleteButton.Visible = True
End If

This is in the startup form among the first code that runs. In fact this
form remains invisible to the users at all times.

This may or not be relevant to your dB, but works well for mine!
Mich


I am starting my database with the database window and built-in
toolbars hidden. Certain people have the right to created new queries,
so I have created a button (which is visible only for these people)
that will display the database window so they can access queries.

The problem is the Query Design Toolbar is not displayed when they go
into Design view. I have tried to show the toolbar using the following
statement, without success:
---DoCmd.ShowToolbar "Query Design", acToolbarYes

I have tried putting this statement before and after the statement
that opens the database window, and it still doesn't show the toolbar.

So now I've tried to set the toolbar option to allow built-in toolbars
first, but that doesn't help either. My current code looks like the
following, so can anyone tell me what I missed or need to change?

Application.SetOption "Built-In Toolbars Available", True
DoCmd.ShowToolbar "Query Design", acToolbarYes
DoCmd.SelectObject acQuery, "", True

WOW, no one has any suggestions? I didn't think this was that hard to
do, but I guess I was wrong! :(
 

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