Dim rs As New ADODB.Recordset
rs.Open "SELECT * FROM accounts WHERE username = '" & Text1 & "'", elie, adOpenStatic, adLockReadOnly
If rs.RecordCount <> 0 Then
If Text2 = rs!Password Then
MsgBox "Login Succesful!", vbInformation, " "
Text2.Text = ""
With rsaccounts
.Fields(0) = Text1.Text
.Fields(1) = Text2.Text
elie.Execute ("Insert Into Accounts(LastLogin) Values(#" & Date & "#)")
.Update
main.Show
Unload Me
Else
MsgBox "Invalid Password, try again!", vbCritical, " "
Text2.Text = ""
Text2.SetFocus
End If
Else
MsgBox "Invalid Login, try again!", vbCritical, " "
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End If
I got runtime error '-2147467259 (80004005)': index or primary key cannot contain a null value
highlighted part:
elie.Execute ("Insert Into accounts(LastLogin) Values(#" & Date & "#)")
btw my primary key is username,
I'm trying to put the current date onto my lastlogin fields,
thanks for helping

New Topic/Question
Reply



MultiQuote




|