User() timer()

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
 
K

Klatuu

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
 
K

Klatuu

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top