Here is the code for checking the password.
Private Sub Login_Click()
On Error GoTo Err_Login_Click
If Me.PassVerify = Me.Password Then
Dim MemName, MyDate, MyMonth, YourMonth, MyDay, MyYear
MyDate = Now() ' Assign a date.
MyMonth = month(MyDate) 'Determines current month number
YourMonth = MonthName(MyMonth) 'Determines current month name
MyDay = day(MyDate) 'Determines current day
MyYear = year(MyDate) 'Determines current year
MemName = Me.Username
Me.LoginOkLabel.Caption = MemName & " has attended class on " & YourMonth &
" " & MyDay & ", " & MyYear
Else
Me.LoginOkLabel.Caption = "Incorrect Password, please try again"
Dim Msg, Style, Title, Help, Ctxt, Response
Msg = "The password you entered is incorrect," + Chr(13) + _
"Please try again" ' Define message.
Style = vbOKOnly + vbCritical ' Define buttons.
Title = "Login Failed" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
End If
Me.PassVerify = Null
Exit_Login_Click:
Exit Sub
Err_Login_Click:
MsgBox Err.Description
Resume Exit_Login_Click
End Sub
I am going to try to write in code based on what you recommended. Or will
this code interfer with the code you recommended
Ofer said:
What is the code you have now, when you verify the password?
In general I would use Append SQL to insert the values
Docmd.RunSql "INSERT INTO MycommentTable ( [UserId], [DateEntered]) VALUES
(" & UserIdVariable & ", Now())"
I assume that you know the UserId, so set it in the UserIdVariable.
=============================================
If the UserId field type is string, add a single quote before and after
Docmd.RunSql "INSERT INTO MycommentTable ( [UserId], [DateEntered]) VALUES
('" & UserIdVariable & "', Now())"