User() timer()

  • Thread starter Thread starter timer ()
  • Start date Start date
T

timer ()

Dear,

I want put timer to forms i want time change automatically in a every
seconds, pls give the codings.

and how to capture the user id () to login forms, how to pull the user id or
user name,

Kindly adviced as above mentioned issue.

Brgrd/Nagarajan
 
To show the time changing every second, set the form's Timer Interval
property to 1000.
Put this in the Control Source property of the text box to show the time:
=Now()

In the Timer Event:

Me.txtClock.Requery

To get the name of the user currently logged into Windows, create a standard
module and paste this code into it:

Private Declare Function GetUserNameA Lib "Advapi32" (ByVal strN As String,
ByRef intN As Long) As Long
Public Function GetUserID()

Dim Buffer As String * 20
Dim Length As Long
Dim lngresult As Long, userid As String

Length = 20

lngresult = GetUserNameA(Buffer, Length)
If lngresult <> 0 Then
userid = Left(Buffer, Length - 1)
Else
userid = "xxxxxxx"
End If
GetUserID = UCase(userid)

End Function
 
Unless you are using Access Security (2007 no longer uses security), it will
always return admin.
 
Back
Top