Search for:

Create Login Form Access

👉 Check out my grocery database, https://grocerydynamite.com/

We need a table that relates users to the level of access they have in the database. The 3 columns needed are Username, Password, and Security Level.

We need a form that lets us enter our password and check the database for validity and deny entry to invalid credentials. A VBA Macro is also needed to make this work.

The forms we need are
Admin
Login
Welcome

-Code-

Dim Userlevel As Integer

If IsNull(Me.username) Then
MsgBox “Please enter the correct username.”, vbInformation, “Username required”
Me.username.SetFocus

ElseIf IsNull(Me.password) Then
MsgBox “Please enter the correct Password.”, vbInformation, “Password required”
Me.password.SetFocus

Else
    If (IsNull(DLookup("username", "UserAccount", "Username='" & Me.username.Value & "'"))) Or _
    IsNull(DLookup("Password", "UserAccount", "Password='" & Me.password.Value & "'")) Then
    MsgBox "Username or Password is Incorrect!", vbCritical, "Login Denied"
    Me.username = ""
    Me.password = ""
    Me.username.SetFocus

Else
Userlevel = DLookup("[Security Level]", "UserAccount", "Username='" & Me.username.Value & "'")


        If Userlevel = 1 Then
        MsgBox "Access Granted... you may proceed!", vbInformation, "Authentication Succeeded"
        DoCmd.RunCommand acCmdSaveRecord
        DoCmd.Close
        DoCmd.OpenForm "Welcome"

End If

        If Userlevel = 2 Then
        MsgBox "Access Granted... you may proceed!", vbInformation, "Authentication Succeeded"
        DoCmd.RunCommand acCmdSaveRecord
        DoCmd.Close
        DoCmd.OpenForm "Admin"

End If
End If
End If

End Sub

How To Generate A Password With Random Letters And Numbers In Excel

Password Generator Video using MS Excel

The video is showing how to generate a password with random letters and numbers in excel information but also try to cover the following subject:

-generate random password in excel

-excel vba random password generator

-excel vba password generator free download

So you want to find out more about how to generate a password with random letters and numbers in excel, i did too and here’s the result.

How to generate a password with random letters and numbers in excel interested me so i did some research and published this to YouTube .

Code could be found here: https://docs.google.com/spreadsheets/d/1A-51tP76i5dz2jzyNKkdPaEb803es_9r/edit?usp=sharing&ouid=112789133191213312498&rtpof=true&sd=true

Be sure to click Enable Editing when opening in Microsoft Excel.

Be sure to click Enable Content when opening in Microsoft Excel.

Sub rand()

Dim length As Integer
Dim char As Variant
Dim x As Long
Dim str As String

‘length = 10
length = Sheet1.Range(“C3”).Value

‘check if length is greater than 0

If length < 1 Then
MsgBox “Length must be greater than 0”
Exit Sub
End If

‘Bank of Characters

char = Array(“a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, _
“k”, “l”, “m”, “n”, “o”, “p”, “q”, “r”, “s”, “t”, “u”, “v”, “w”, “x”, _
“y”, “z”, “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “!”, “@”, _
“#”, “$”, “%”, “^”, “&”, “*”, “A”, “B”, “C”, “D”, “E”, “F”, “G”, “H”, _
“I”, “J”, “K”, “L”, “M”, “N”, “O”, “P”, “Q”, “R”, “S”, “T”, “U”, “V”, _
“W”, “X”, “Y”, “Z”)

‘Select random characters from the bank.

For x = 1 To length
Randomize
str = str & char(Int((UBound(char) – LBound(char) + 1) * Rnd + LBound(char)))

Next x

Sheet1.Range(“C4”).Value = str

With New MSForms.DataObject
.SetText Sheet1.Range(“C4”).Value
.PutInClipboard
End With

End Sub

Available for Amazon Prime