Jim DeMarco
Jdemarco at hudsonhealthplan.org
Tue Sep 7 08:41:21 CDT 2004
I don't think you can hide it in a code module but you do have ways to obscure it. If a user gets into this code they can bypass the security anyway so encrypting or hiding the value in a module will only provide very limited trouble to someone who wants to get in. 1. Put the value in a table and name the table and field something completely unrelated to security (i.e Table Name: tblCleanup, FieldName: Status). Then use a recordset to grab the check value. 2. Rename the variables to something harmless and break the variable up into pieces using concatenation to put it back together: 3. If Pass is a control on your form rename that to something harmless as well so as not to provide clues to its function. Here is your code rewritten with this technique applied. Of course you'll use dummy variable names that hide what you're doing better than these examples. Dim sStart as String dim Green as Boolean Dim sMid as String Dim stDocName as String Dim sEnd as String dim stLinkCriteria as String Dim sPutItTogether as String sStart = "1" Green = False sMid = "2" 'add a comment or two here to separate the two values (mid and end) sEnd = "3" sPutItTogether = sStart & sMid & sEnd If Status = sPutItTogether Then Green = True End If If Green Then stDocName = "MT_entoli" stLinkCriteria = "[AM]=" & [Forms]![MT_basic_char]![AM] DoCmd.OpenForm stDocName, , , stLinkCriteria DoCmd.Close acForm, "P_Form" Else DoCmd.Close End If HTH, Jim DeMarco -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Kostas Konstantinidis Sent: Tuesday, September 07, 2004 9:25 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Protecting a subform with password Hi group, thank's all for your response to my question I tried the follown (which seems to work) and was wondering if it could be possible and how to hide the line "Level0Pass = "123"" making it unreadable e.g. instead of 123 to appear *** thank you kostas Private Sub Command0_Click() Dim Green As Boolean, Level0Pass As String, stDocName As String, stLinkCriteria As String Level0Pass = "123" Green = False If Pass = Level0Pass Then Green = True End If If Green Then stDocName = "MT_entoli" stLinkCriteria = "[AM]=" & [Forms]![MT_basic_char]![AM] DoCmd.OpenForm stDocName, , , stLinkCriteria DoCmd.Close acForm, "P_Form" Else DoCmd.Close End If End Sub -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". ***********************************************************************************