Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Printing 1

Status
Not open for further replies.

MrsNic

Instructor
Feb 6, 2005
44
GB
I have just created a small library database for use by the school library, but I don't want the pupils to be able to print the results, just view them on screen. Is there a way to hide the print option from the pupil's view but enable it when logging on as an administrator?

Many thanks
Cath
 
Add a reference to the Microsoft scripting runtime, then the following function will return True if the current user is a member of the Domain administrators group.

Code:
Private Function IsAuthorised() As Boolean
    ' Returns TRUE if the current network user is a member of Administrators security groups. Need 
    
    Dim objNetwork As Object
    Dim strUsername As String
    Dim strContext As String
    Dim objGroup As Object
    Dim objUser As Object
    Dim objGroups As Object
    
    Set objNetwork = CreateObject("wscript.Network")
    
    strUsername = objNetwork.UserName
    strContext = objNetwork.userdomain
    
    Set objUser = GetObject("WinNT://" & strContext & "/" & strUsername)
    Set objGroups = objUser.Groups
    
    For Each objGroup In objGroups
        Debug.Print objGroup.Name
        If objGroup.Name = "Administrators" Then IsAuthorised = True
    Next
End Function

Of course, now you can use this to hide buttons and print options on the menu, but what you can't do easily is stop the students pressing Ctrl P.

John
 

MrsNic,

As John said, you can't keep the students from pressing Ctrl P. Peventing printing is very difficult (consider screen prints, for example).

Sometime after I joined TT in Dec. 2004, there was an extensive thread (theads?) on this issue. Try searching the forums and you may pick up some additional ideas.

Good Luck!
Tim


[blue]_____________________________________________________
If you need immediate assistance, please raise your hand.
If you are outside of Raleigh, raise your hand and say
[/blue] [red]Ooh! Ooh![/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top