Table of Contents


MS Access comes with an inbuilt Input Box, that looks simply like a Message Box and can read an Input. This can be quiet useful when you are using values that are not sensitive, if you want to input an override password to reduce the price, or view sensitive information like account numbers. You cannot use the Input Box, you need is a Password box. Unfortunately, Access does not come with this functionality. This article will demonstrate how to implement this Password Box.

A sample DB file has been uploaded in the Gallery section for better understanding - Password Box - A variant of Input Box

Steps Involved

You can follow the steps one at a time, to get to where you want it to be.

  • Create an Unbound Form call it frmPassword_Box, with a Text field (that will be your input box), two buttons OK and CANCEL. 
  • On the 'On_Click' event of the 'CANCEL' button close the form, on the 'On_Click' event of 'OK' button make the FORM invisible i.e. until the value has been validated for then you can close it.
  • In design mode change the 'Input Mask' of the Text Box to Password. Thus we can make sure it appears to be DITO of the Input box, but for Passwords.
  • Create a Function inside a common module call it Call_Password_Box, then enter the code inside
DoCmd.OpenForm FormName:="frmPassword_Box", _
    View:=acNormal, _
    'Call to open the Form
If CurrentProject.AllForms![frmPassword_Box].IsLoaded Then
    Call_Password_Box = Forms![frmPassword_Box]!Text3.Value
    'The Password is obtained to be forwarded to the method that made the call.
    DoCmd.Close acForm, "frmPassword_Box"
    Call_Password_Box = vbNullString         
    'If Closed or Cancel is pressed a NULL String is returned.
End If
  • Save all changes, compile to see if there are any errors. 
Now you have a 'Authentication Terminal' which can be called for when you need it.

Usage maybe for single authentication (maybe a default Admin password) or use a Table with list of all passwords and ID and use DLookUp for comparing.

Something like.

If Amount_Entered < Default_Value Then
    If Call_Password_Box = "adminApprove" Then
        ' do what you want to
        MsgBox("Sorry the amount entered cannot be approved (OR) Incorrect Password", vbCritical)
    End If
End If

Since the Function is placed inside a module you can call it from any Form that you desire to give access/provide authentication to.

You are free to use this code in your application, but it would be really great if you could stick a note, acknowledging where you got this code from and the name of the author!