Skip to content

Instantly share code, notes, and snippets.

@jeffreyvr
Created January 23, 2018 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffreyvr/572ae8ea3ba5692bc10a60e3783ac0d6 to your computer and use it in GitHub Desktop.
Save jeffreyvr/572ae8ea3ba5692bc10a60e3783ac0d6 to your computer and use it in GitHub Desktop.
Access VBA Login
Option Compare Database
Private Sub LoginBtn_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("select * from dbo_Medewerker where medewerkerloginnaam='" & GebruikersnaamTxt.Value & "'")
If rst.RecordCount <= 0 Then
MsgBox "Invalide login", vbCritical
GebruikersnaamTxt.SetFocus
Else
If IsNull(PasswordTxt.Value) Or rst("Wachtwoord") <> PasswordTxt.Value Then
MsgBox "Invalide wachtwoord", vbCritical
PasswordTxt.SetFocus
Else
DoCmd.Close
DoCmd.OpenForm "Inloggen Rapportages"
End If
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment