Disable Menu bar and create MDE file

melinda

Registered User.
Local time
Tomorrow, 02:14
Joined
Feb 19, 2003
Messages
31
i have a few problems

i had some problem when i try to disable some menu in menubar.
i want some menu just enable for a few user.
so, what should i do ?

second problem :
i cannot make MDE file. i don't know why....
message apear : "Unable to make MDE file"

Help me please....

Best Regards
 
When you are unable to create a mde it is usually because you have some left over code from a button that you deleted. Go into the VBA editor and confirm that every event is needed. Then Compile and Save. Then try making your mde.

You can use the CurrentUser() to look for particular usergroups (if you have applied security to the db) and then set the Menubar of choice to display. Do a search on CurrentUser for examples. There has been some recent postings about using the NetWorkLogin to see who is in the db so you might try to search on that as it would not require that you have security in place. See this post by ghudson with example of how to display / hide menu / toolbars.

http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=42094

Autoeng
 
Last edited:
Thx Autung but...

Thanks so much for ur information Autoeng...

I will try to check and make MDE.

About Disable menu...

i already seen topic about that. i am using it to hide menubar and tool bars from access.

Here is my example of my menu bar (actualy my menu bar more complex) :

Master Transaction
Region Invoice
Customer Receive Payment
Supplier

I want invoice to be Grey (un active) or hide if user not have permission on it, but Receive Payment still there if user can access this form.

Every user have different Permission and i acnnot predict it.
it depends on user demand.

so, what should i do ? i still confuse about efective way to do it.
Ur information will help

Thank You.
 
The following code requires a reference to Mictosoft OFFICE 9.0 object library. (Office library, not Access)

Copy the following to a module

Notes first: The custom menu bar this controls is called 'TicketWizz'(Substitute your menu bar name)

The functions SetPrintToolsOff() SetPrintToolsOn()
enables and disablies the second menu item on the menu bar

SetTicketWizzOff() SetTicketWizzOn()
enables and disablies the forth item in the list on the first menu item on the menu bar

Just call these functions from your log on screen or where ever
If userlevel = dumbass then
Call SetPrintToolsOff
Else
Call SetPrintToolsOn
End If


Option Compare Database
Option Explicit
Dim MyBar As Variant

Public Function CommandbarEnable(Cmdbar As CommandBar, CmdbarEnabled As Boolean, TopLevel As Integer, Optional Sublevel As Integer)
Dim SubCommandbar
On Error GoTo Err_CommandBarEnable

'If the command bar is not visible, make it so.
If Cmdbar.Visible = False Then Cmdbar.Visible = True

'If no menu item on a submenu is selected for enabling\disabling,
'enable\disable the top level menu choice only.
If IsMissing(Sublevel) Or Sublevel = 0 Then
Cmdbar.Controls(TopLevel).Enabled = CmdbarEnabled
'If a menu item on a submenu is selected for
'enabling\disabling, do so now.
Else
Set SubCommandbar = Cmdbar.Controls(TopLevel)
SubCommandbar.Controls(Sublevel).Enabled = CmdbarEnabled
End If

Exit_CommandBarEnable:
Exit Function

Err_CommandBarEnable:
MsgBox "Error " & CStr(Err) & " " & Err.Description & _
" has occurred in the CommandBarEnable Function", vbOKOnly, _
"Error Detected"
Resume Exit_CommandBarEnable

End Function

Public Function SetPrintToolsOff()
'Disables the 'Design Tools' command on the menu bar

MyBar = CommandbarEnable(CommandBars("TicketWizzPrint"), False, 2)

End Function

Public Function SetPrintToolsOn()
'Enables the 'Design Tools' command on the menu bar

MyBar = CommandbarEnable(CommandBars("TicketWizzPrint"), True, 2)

End Function

Public Function SetTicketWizzOff()
'Disables the 'TicketWizz' menu command on the menu bar if the program trial period ends

MyBar = CommandbarEnable(CommandBars("TicketWizzPrint"), False, 1, 4)

End Function

Public Function SetTicketWizzOn()
'Disables the 'TicketWizz' menu command on the menu bar if the program trial period ends

MyBar = CommandbarEnable(CommandBars("TicketWizzPrint"), True, 1, 4)

End Function


HTH
Dave
 
Sorry...
As for not being able to make an MDE
There is usually a code error
When in the VB window go tools - compile
This will highlight any errors or missing references
Dave
 
Thanks OldSoftBoss

Thanks for ur information Old SoftBoy....

I use User Level Security, so I only once log on. i dont have my own log on screen. it's from access User level Sec.

so where should i put that code ?
i cannot find that log on screen ?

i just wodering,

If i use User Level Security and i want to disable and enable my menu bar depends on permission in User Level Security,
can it be done ?
How ?

i am very confuse ? Help me please ?

Best Regards
 
I dont use Access security. I have developed my own secrity that at least I can understand :)
 
Hey.. Whats this OldSoftboy ??:mad:

O hang on, your right, my user ID is incorrect :D
Dave
 
:)

sorry Dave for miss type ur ID ... :D

if u use ur own security, could u tell me more about it ?

what do u do to prevent user hold Shift key when they open ur database ?

how do u prevent user to modify ur table, form, query, report and macro ?

would you tell me about it ?

thanks
 
ghudson has the 'forum standard' for the disabing of the shift key bypass.
If you password protect you code, the forms and modules cant be imported into a fresh Db. Also if you hide the tables they also wont be visible when someone tries to import. As for the queries etc ... not much use without the tables.
Dave
 
where ?

ghudson has the 'forum standard' for the disabing of the shift key bypass.

-- where i could find that (example) ?

best regards
 
Thanks

Thanks Dave....

i'll try to make my own security

have a nice day...
:p ;)
 

Users who are viewing this thread

Back
Top Bottom