Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Compare Database
- Option Explicit
- Dim bCanSafleyClose As Boolean
- Private Sub btnLogin_Click()
- Dim rst As Recordset
- Set rst = CurrentDb.OpenRecordset("SELECT * From tblUsers WHERE UserName = '" & txtUsername & "' AND Password = '" & txtPassword & "' AND UserType ='" & cmbxUserType & "';")
- If rst.RecordCount = 1 Then
- bCanSafleyClose = True
- DoCmd.Close
- DoCmd.OpenForm "Main"
- Else
- MsgBox "Error!"
- bCanSafleyClose = False
- End If
- End Sub
- Private Sub Form_Load()
- bCanSafleyClose = False
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- 'Cancel = Not bCanSafleyClose
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement