yes, you can, but you cannot use inputbox, you must use a form...
make an unbound form:
Name --> usys_pw
Caption --> Enter Password
RecordSelectors --> No
NavigationButtons --> No
DividingLines --> No
AutoResize --> Yes
AutoCenter --> yes
Popup --> yes
Modal --> yes
controls:
textbox -->
Name --> EnterP
InputMask --> Password
Label_Prompt -->
Caption: Enter Password
code behind form:
'~~~~~~~~~~~
Private Sub EnterP_AfterUpdate()
SetRight (Me.EnterP)
DoCmd.Close acForm, Me.Name
End Sub
Private Sub Form_Load()
If Len(Nz(Me.OpenArgs)) = 0 Then
Me.Label_Prompt.Caption = "Enter Password"
Else
Me.Label_Prompt.Caption = Me.OpenArgs
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
SetPW
End Sub
'~~~~~~~~~~~
when you want to use it:
'~~~~~~~~~~~
DoCmd.OpenForm "usys_pw", , , , , acDialog, _
"Enter Password to Edit"
If Not GetPW() Then
msgbox "You may not edit the record", , "Incorrect password"
'if this is on the Open event of a form
Cancel = True
Exit Sub
End If
'~~~~~~~~~~~
"Enter Password to Edit" --> or whatever you want the prompt be be if
other then "Enter Password"
in a general module:
'~~~~~~~~~~~
Dim gBooPW As Boolean
Function SetPW()
gBooPW = False
End Function
Function GetPW() As Boolean
GetPW = gBooPW
End Function
Function SetRight(pPW) As Boolean
gBooPW = IIf(Nz(pPW) = "yourpassword", True, False)
End Function
ie: "yourpassword" -- "aaa"
'~~~~~~~~~~~
note: I prefaced the formname with "usys" (user system -- like Msys --
Microsoft system) because it will only display if system objects are
checked under Tools, Options, View tab -- which, usually, they aren't
Warm Regards,
Crystal
*
have an awesome day
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*