We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Private Sub Form_Open(Cancel As Integer) Dim Hold As Variant Dim tmpKey As Long Dim I As Integer Dim rs As DAO.Recordset Dim db As DAO.Database On Error GoTo Error_Handler ' Prompt the user for the Password. Hold = InputBoxDK("Please Enter Your Password", "Enter Password") ' Open the table that contains the password. Set db = CurrentDb Set rs = db.OpenRecordset("tblKeyCode", dbOpenTable) rs.Index = "PrimaryKey" rs.Seek "=", Me.Name If rs.NoMatch Then MsgBox "Sorry cannot find password information. Try Again" Cancel = -1 Else ' Test to see if the key generated matches the key in ' the table; if there is not a match, stop the form ' from opening. If Not (rs![KeyCode] = KeyCode(CStr(Hold))) Then MsgBox "Sorry you entered the wrong password." & _ "Try again.", vbOKOnly, "Incorrect Password" Cancel = -1 End If End If rs.Close db.Close Exit Sub Error_Handler: MsgBox Err.Description, vbOKOnly, "Error #" & Err.Number Exit Sub End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|VBA code to use a table to create a new temp table with a column added||4||33|
|Using Access multi Listbox to pass criteria to a query||9||31|
|How to loop thru all queries and find which one's were affected by a table change.||47||41|
|Access Criteria - Select first word from a string||27||34|