Multiple conditions statement using sql
Posted on 2006-07-18
I have a validation form that validates the user using 5 or so conditions with the results of the true condition gets written to a log table. I cant seem to get it to work correctly.
conditions are -
1 - If the user is not in the database then write into the log "not found"
2 - if the user is found but has an expired membership the "membership expired"
3 - if the user is found but has no membership then "Invalid membership"
4 - if the user is in the database and all conditions are met then "Login success"
here is a sample of one of the conditions(this one is for login fail):
Dim rs1 As DAO.Recordset
Set rs1 = CurrentDb.OpenRecordset("SELECT * FROM my_table WHERE pin = '" & Me.pin & "'")
If rs1.EOF Then
Dim rs2 As DAO.Recordset
Set rs2 = CurrentDb.OpenRecordset("SELECT * FROM log")
rs2!id_num = Me.pin
rs2!Stamp = Now()
rs2!Station = Environ("computername")
rs2!Action = DLookup("login_responder", "messages", "msg_cde = 'LIF'")