benkingery
Registered User.
- Local time
- Today, 13:08
- Joined
- Jul 15, 2008
- Messages
- 153
I am trying to implement a password protected timecard database and I am having a hard time validating the user and PIN Number on the clock in form. I have a table (Employee) containing Social Sec. Number (SSN, PK) and Pin number (PersonalPIN). Within my form, on the afterupdate portion of the pin number, I want to trigger a validation to query the employee table for a match between the SSN and PIN (both are unbound fields) they put in on the form. From is called TimeCard
here is what I have so far:
I am getting a sytax error on the SQL statement. Pretty sure I have the wrong syntax on the part where I'm trying to insert the values from the unbound text fields.
Thanks in advance for help.
here is what I have so far:
Code:
Private Sub PIN_AfterUpdate()
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
Dim myRecordSet As ADODB.Recordset
myRecordSet.ActiveConnection = cnn1
Dim SQL As String
SQL = "SELECT Employee.SSN, Employee.PersonalPIN FROM Employee WHERE (((Employee.SSN)=" & SSN.text) AND ((Employee.PersonalPIN)=" & PIN.text))"
myRecordSet.Open (SQL)
'recordcount
If RecSet.RecordCount > 0 Then
'user does exist in database
MsgBox(I WILL CODE DESIRED FUNCTIONALITY HERE")
Else
'user does not exist
MsgBox("I WILL CODE DESIRED FUNCTIONALITY HERE")
End If
myRecordSet.Close
cnn1.Close
Set cnn1 = Nothing
Set myRecordSet = Nothing
End Sub
I am getting a sytax error on the SQL statement. Pretty sure I have the wrong syntax on the part where I'm trying to insert the values from the unbound text fields.
Thanks in advance for help.