NeaPa,
Following code in used for disable sub-menu items for specified user. The problem I am having is one of below user is not able see it (Mean disabled the sub-menu items) I want both of them to see sub-menu when they currently on database. Any there is anything wrong with this code which causing one user unable to use sub-menu items. - Dim blnShow As Boolean
-
-
blnShow = Nz(StrComp(Me.MyName, "aman", vbTextCompare), True) = False
-
With CommandBars("MyMenu").Controls(1)
-
.Controls(1).Enabled = blnShow
-
.Controls(2).Enabled = blnShow
-
.Controls(3).Enabled = blnShow
-
End With
-
-
blnShow = Nz(StrComp(Me.MyName, "Ram", vbTextCompare), True) = False
-
With CommandBars("MyMenu").Controls(1)
-
.Controls(1).Enabled = blnShow
-
.Controls(2).Enabled = blnShow
-
.Controls(3).Enabled = blnShow
-
End With
Prompt help appreciated
Thanks a lot
3 2481
Hi
On the basis that strComp returns 0 (zero) when the match is found (seem the wrong way round to me - never used it before) then for two users as indicated I suggest this - Dim blnShow As Boolean
-
-
blnShow = Nz(StrComp(MyName, "aman", vbTextCompare), True) And Nz(StrComp("Ram", "aman", vbTextCompare), True)
-
-
With CommandBars("MyMenu").Controls(1)
-
.Controls(1).Enabled = blnShow
-
.Controls(2).Enabled = blnShow
-
.Controls(3).Enabled = blnShow
-
End With
??
For more than two users I would have a lookup table in the back end and use DLookUp(), or more probably DCount() to deal with the Null case, to determine who cannot use the menu item.
MTB
MTB,
Thanks a lot for sharing. I have already resolved this task, The following has been used instead of earlier one and working perfect - Select Case Me.MyName
-
Case "aman"
-
With CommandBars("MyMenu").Controls(1)
-
.Controls(1).Enabled = True
-
.Controls(2).Enabled = False
-
.Controls(3).Enabled = False
-
End With
-
-
With CommandBars("MyMenu").Controls(2)
-
.Controls(1).Enabled = True
-
.Controls(2).Enabled = True
-
-
End With
-
-
Case "Ram"
-
With CommandBars("MyMenu").Controls(1)
-
.Controls(1).Enabled = True
-
.Controls(2).Enabled = True
-
.Controls(3).Enabled = False
-
End With
-
End Select
Thanks a lot for again sharing
NeoPa 32,556
Expert Mod 16PB
If you have two (multiple) users then use InStr() instead : - Dim blnShow As Boolean
-
-
blnShow = (InStr(1, ";aman;ram;", ";" & Me.MyName & ";", vbTextCompare) > 0)
-
With CommandBars("MyMenu").Controls(1)
-
.Controls(1).Enabled = blnShow
-
.Controls(2).Enabled = blnShow
-
.Controls(3).Enabled = blnShow
-
End With
NB. Don't forget the separators (I used semi-colons (;) in this case) as otherwise you may find a user called "ama" is matched in error.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ZubZero |
last post by:
Hello,
i have to write a utility in c++ for windows 2k/XP.
But i have 2 difficult problems.
I asked many programmers i know, but none of them was able to tell me
how i can do this.
1. I...
|
by: Hemal2k |
last post by:
To disable specific key in IE and Firefox
Solution :-
//call ValidateInvalidCharacters(event); function from form body....
<body onkeypress="ValidateInvalidCharacters(event);" leftMargin="0"...
|
by: tottigang |
last post by:
Hi,
I have a tabstrip and I have some tabs in it. On the first page, all
the tabs are enabled, I need to disbale part of the tabs at a specific
point in the application and again enable them. I...
|
by: alex |
last post by:
Hi,
is there an easy way to disable (prevent from edit) specific rows in a
datagrid ?
Alex
|
by: Brian Henry |
last post by:
I want to time how long a specific sub takes to execute, what is the best
way to do this? this is only for one sub, and i just need a result back in
milliseconds or such to display to a user....
|
by: Tanja Krammer |
last post by:
Hi experts,
is it possible to disable linker warnings (i.e. LNK4204)?
Thanx
|
by: tommaso.gastaldi |
last post by:
It would be useful, sometimes, when debugging, to disable
all the try /catch one has in the program (clearly not commenting them
out).
Any info or hint on that?
-tom
|
by: badkarspiloten |
last post by:
Hi there!
I have just migrated from VS 2003 to VS 2005 and are getting lots of
compile warnings when building my solution. Some of them I want to
disable.
I have managed to do this with my...
|
by: Bob Alston |
last post by:
Anyone know how to disable or redefine the Ctrl - hotkey which deletes a
record? I have a multi page form that uses 14 records, each record
handles 1-2 pages of the 18 page form. Occasionally ,...
|
by: ValValVal |
last post by:
Hi all.
I have a JTable with 5 columns. Cell Selection is ON. I want to disable user's ability to select any cell that is on 0-th column. Can't find any info on how to cope with it.
Thanks in...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |