dlookup question

  • Thread starter A.J.M. van Rijthoven
  • Start date
A

A.J.M. van Rijthoven

For a login procedure I want to check te username and password in a
table. I als want to check if the useraccount is still active or not.
I have a table 'inloggen'with the following fields:
logid (autonumber)
inlognaam (string)
wachtwoord (string, password mask)
functie (string)
vervallen (date)

The user enters a username and password and i want to check if the
user exists and the password is correct with dlookup. So far
everything worked fine, but I also wanted to make an account inactive
so the dlookup feature must also check whether the account is active
or not (wachtwoordcontrole).
This is where I get strange errormessages. Can someone please help me?
(inlnaamid and inlfunctie are global variables)

Dim wachtwoordcontrole As Variant
inlnaamid = ""
inlfunctie = ""

wachtwoordcontrole = DLookup("[wachtwoord]", "inloggen", "[inlognaam]
= '" & Forms!frminloggen!ingevoerdenaam & "' and [vervallen]= '" &
"'")
If IsNull(wachtwoordcontrole) Then
MsgBox "Gebruiker onbekend....", vbExclamation, "Fout"
Me.ingevoerdenaam.SetFocus
Exit Sub
End If
If IsNull(ingevoerdwachtwoord) Then
Exit Sub
End If
If ingevoerdwachtwoord <> wachtwoordcontrole Then
MsgBox "Fout wachtwoord...", vbExclamation, "Fout"
Me.ingevoerdwachtwoord.SetFocus
Else
inlfunctie = DLookup("[functie]", "inloggen", "[inlognaam] = '" &
Forms!frminloggen!ingevoerdenaam & "'")
inlnaamid = DLookup("[logid]", "inloggen", "[inlognaam] = '" &
Forms!frminloggen!ingevoerdenaam & "'")
If inlfunctie = "admin" Or inlfunctie = "applicatiebeheer" Then
Forms!opstarten.basistabel.Enabled = True
Forms!opstarten.KnpVolgordeInleggen.Enabled = True
datawijzigen = True
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top