How to add password to existing code?

CarolW

Registered User.
Local time
Today, 06:02
Joined
Mar 24, 2006
Messages
58
Hello everybody,
Can anyone out there please help me? I’ve been wandering around the various forums trying to gain some advice concerning password protecting a form. I have tried in vain to tackle this one on my own but alas I cannot, and hence I am turning to some kind person out there to try to help me out of my problem.

Having searched the various forums extensively, and have seen numerous examples all of which work fine,however in a different context; I cannot for the life of me understand where I could incorporate such code along with the existing code that I already use, with great success to open a linked form. All I want to achieve is for a user to click on a command button and for it to prompt for a password and then to open up my form which is synchronised to the original form that contains the command button.

What I have so far is:

Private Sub Command146_Click()
On Error GoTo Err_Command146_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RestrictedAccess"

stLinkCriteria = "[Medical.Release No]=" & "'" & Me![PatientNumber] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command146_Click:
Exit Sub

Err_Command146_Click:
MsgBox Err.Description
Resume Exit_Command146_Click

End Sub



I read the following thread from Ghudson showing a good example of password protecting a form but how do I use such code in the example that I have above.

http://www.access-programmers.co.uk/...ad.php?t=85846


Any help or guidance in this area would be extremely welcome and gratefully appreciated.....

P.S: This site has been invaluable to me in the past, particularly as I am a relative newcomer to Access and VBA.

Best Regards

Thanks for taking the time out to read.....

Carol
 
Password to existing code

mhartman said:
Hello

Please see Candace Tripp's internet page. Refer to her "Boiler Plate Database". This has an example of what your looking for. Enclosed is the link.
http://www.utterangel.com/pages/access_downloads.aspx
'
Regards
Mark
Mark,
Thank you very much for taking the time out to reply - it looks very much like what I was after. Hopefully i'll be able to get my code problem sorted.....

Regards
Carol
 

Users who are viewing this thread

Back
Top Bottom