How to Get /trace users in NT domain using Vb
How to trace users who r making changes to records in an application.I want
to know when the record was created ,Who created it first.Later to some field/fields
modifications/additions are peformed maybe by same user or another user who
has access to the same record.I have to store the modifications seperately.That
is the modification is seperate but is with respect to that record.
Please reply ASAP
Kumar
[437 byte] By [
kumar72] at [2007-11-10 0:19:48]

# 1 Re: How to Get /trace users in NT domain using Vb
Kumar,
>How to trace users who r making changes to records in an application.I want
>to know when the record was created ...
There is no way that this is relevant to API discussions, so I've
forwarded this to vb.database.design.
That said, the easiest way, IMO, is to create a trigger on your table
that inserts new records into a transaction queue whenever a change or
insert occurs on the table.
Ciao, Craig
# 2 Re: How to Get /trace users in NT domain using Vb
Kumar,
>How to trace users who r making changes to records in an application.I want
>to know when the record was created ...
There is no way that this is relevant to API discussions, so I've
forwarded this to vb.database.design.
That said, the easiest way, IMO, is to create a trigger on your table
that inserts new records into a transaction queue whenever a change or
insert occurs on the table.
Ciao, Craig
# 3 Re: How to Get /trace users in NT domain using Vb
Craig Clearman <chclear@nospam.please> wrote:
>Kumar,
>
>>How to trace users who r making changes to records in an application.I
want
>>to know when the record was created ...
>
>There is no way that this is relevant to API discussions, so I've
>forwarded this to vb.database.design.
>
>That said, the easiest way, IMO, is to create a trigger on your table
>that inserts new records into a transaction queue whenever a change or
>insert occurs on the table.
>
>Ciao, Craig
>
craig,
I used the code u have posted to find out user on a machine having loadusers
function.this is the error i am facing when executing in VB 6.0.
at this point
Dim userEnum As Cuser
# 4 Re: How to Get /trace users in NT domain using Vb
Craig Clearman <chclear@nospam.please> wrote:
>Kumar,
>
>>How to trace users who r making changes to records in an application.I
want
>>to know when the record was created ...
>
>There is no way that this is relevant to API discussions, so I've
>forwarded this to vb.database.design.
>
>That said, the easiest way, IMO, is to create a trigger on your table
>that inserts new records into a transaction queue whenever a change or
>insert occurs on the table.
>
>Ciao, Craig
>
craig,
I used the code u have posted to find out user on a machine having loadusers
function.this is the error i am facing when executing in VB 6.0.
at this point
Dim userEnum As Cuser
# 5 Re: How to Get /trace users in NT domain using Vb
Kumar,
>I used the code u have posted to find out user on a machine having loadusers
>function.this is the error i am facing when executing in VB 6.0.
>at this point
If you are trying to get the user that has been logged in, that's
easy.
'==================================================
' Private API Declarations
'==================================================
Private Declare Function WNetGetUser _
Lib "mpr.dll" Alias "WNetGetUserA" ( _
ByVal sComputerName As String, _
ByVal sUserName As String, _
plLength As Long) As Long
'==================================================
' Private API Constants
'==================================================
Private Const NERR_Success As Long = 0&
Private Const ERROR_MORE_DATA As Long = 234&
'==================================================
' Public Procedures
'==================================================
'==================================================
' Procedure: LogonName
'
' Returns: String
'
' Description: This procedure identifies the
' logon id of the current user, as determined by
' the network.
'==================================================
Public Function LogonName() As String
Const INITIAL_GUESS As Long = 25&
Dim nLength As Long
Dim hReturn As Long
Dim sUser As String
'Try to retrieve the information with a default
' size
sUser = Space$(INITIAL_GUESS)
nLength = Len(sUser)
hReturn = WNetGetUser(vbNullString, sUser, nLength)
If hReturn = ERROR_MORE_DATA Then
'If there is too much data to fit into the
' default, then try the new length.
sUser = Space$(nLength)
hReturn = WNetGetUser(vbNullString, sUser, nLength)
End If
If hReturn = NERR_Success Then
'Retrieved a good user id
LogonName = UCase$(StripNull(sUser))
End If
End Function
Debug.Print LogonName()
But if you want to stamp records in your database, your best choice is
to do it on the server.
For instance, in Oracle, you'd use a trigger add set the relevant
fields like this:
:new.userstamp := substr(user,1,8);
:new.timestamp := sysdate;
Ciao, Craig
# 6 Re: How to Get /trace users in NT domain using Vb
Kumar,
>I used the code u have posted to find out user on a machine having loadusers
>function.this is the error i am facing when executing in VB 6.0.
>at this point
If you are trying to get the user that has been logged in, that's
easy.
'==================================================
' Private API Declarations
'==================================================
Private Declare Function WNetGetUser _
Lib "mpr.dll" Alias "WNetGetUserA" ( _
ByVal sComputerName As String, _
ByVal sUserName As String, _
plLength As Long) As Long
'==================================================
' Private API Constants
'==================================================
Private Const NERR_Success As Long = 0&
Private Const ERROR_MORE_DATA As Long = 234&
'==================================================
' Public Procedures
'==================================================
'==================================================
' Procedure: LogonName
'
' Returns: String
'
' Description: This procedure identifies the
' logon id of the current user, as determined by
' the network.
'==================================================
Public Function LogonName() As String
Const INITIAL_GUESS As Long = 25&
Dim nLength As Long
Dim hReturn As Long
Dim sUser As String
'Try to retrieve the information with a default
' size
sUser = Space$(INITIAL_GUESS)
nLength = Len(sUser)
hReturn = WNetGetUser(vbNullString, sUser, nLength)
If hReturn = ERROR_MORE_DATA Then
'If there is too much data to fit into the
' default, then try the new length.
sUser = Space$(nLength)
hReturn = WNetGetUser(vbNullString, sUser, nLength)
End If
If hReturn = NERR_Success Then
'Retrieved a good user id
LogonName = UCase$(StripNull(sUser))
End If
End Function
Debug.Print LogonName()
But if you want to stamp records in your database, your best choice is
to do it on the server.
For instance, in Oracle, you'd use a trigger add set the relevant
fields like this:
:new.userstamp := substr(user,1,8);
:new.timestamp := sysdate;
Ciao, Craig
# 7 Re: How to Get /trace users in NT domain using Vb
Craig Clearman <chclear@nospam.please> wrote:
>Kumar,
>
>>I used the code u have posted to find out user on a machine having loadusers
>>function.this is the error i am facing when executing in VB 6.0.
>>at this point
>
>If you are trying to get the user that has been logged in, that's
>easy.
>
>'==================================================
>' Private API Declarations
>'==================================================
>Private Declare Function WNetGetUser _
> Lib "mpr.dll" Alias "WNetGetUserA" ( _
> ByVal sComputerName As String, _
> ByVal sUserName As String, _
> plLength As Long) As Long
>
>'==================================================
>' Private API Constants
>'==================================================
>Private Const NERR_Success As Long = 0&
>Private Const ERROR_MORE_DATA As Long = 234&
>
>'==================================================
>' Public Procedures
>'==================================================
>
>'==================================================
>' Procedure: LogonName
>'
>' Returns: String
>'
>' Description: This procedure identifies the
>' logon id of the current user, as determined by
>' the network.
>'==================================================
>Public Function LogonName() As String
>
>Const INITIAL_GUESS As Long = 25&
>
>Dim nLength As Long
>Dim hReturn As Long
>Dim sUser As String
>
>'Try to retrieve the information with a default
>' size
>sUser = Space$(INITIAL_GUESS)
>nLength = Len(sUser)
>hReturn = WNetGetUser(vbNullString, sUser, nLength)
>If hReturn = ERROR_MORE_DATA Then
> 'If there is too much data to fit into the
> ' default, then try the new length.
> sUser = Space$(nLength)
> hReturn = WNetGetUser(vbNullString, sUser, nLength)
>End If
>
>If hReturn = NERR_Success Then
> 'Retrieved a good user id
> LogonName = UCase$(StripNull(sUser))
>End If
>
>End Function
>
>Debug.Print LogonName()
>
>But if you want to stamp records in your database, your best choice is
>to do it on the server.
>
>For instance, in Oracle, you'd use a trigger add set the relevant
>fields like this:
>
> :new.userstamp := substr(user,1,8);
> :new.timestamp := sysdate;
>
>Ciao, Craig
>Thanks criag.I am able to get netuser id.
I wnat to generate a text file from the data that is enterd in the controls
of the form.Please help me how to generate the text file i n aparticular
format from the front data entered .
Thanku
kumar
# 8 Re: How to Get /trace users in NT domain using Vb
Craig Clearman <chclear@nospam.please> wrote:
>Kumar,
>
>>I used the code u have posted to find out user on a machine having loadusers
>>function.this is the error i am facing when executing in VB 6.0.
>>at this point
>
>If you are trying to get the user that has been logged in, that's
>easy.
>
>'==================================================
>' Private API Declarations
>'==================================================
>Private Declare Function WNetGetUser _
> Lib "mpr.dll" Alias "WNetGetUserA" ( _
> ByVal sComputerName As String, _
> ByVal sUserName As String, _
> plLength As Long) As Long
>
>'==================================================
>' Private API Constants
>'==================================================
>Private Const NERR_Success As Long = 0&
>Private Const ERROR_MORE_DATA As Long = 234&
>
>'==================================================
>' Public Procedures
>'==================================================
>
>'==================================================
>' Procedure: LogonName
>'
>' Returns: String
>'
>' Description: This procedure identifies the
>' logon id of the current user, as determined by
>' the network.
>'==================================================
>Public Function LogonName() As String
>
>Const INITIAL_GUESS As Long = 25&
>
>Dim nLength As Long
>Dim hReturn As Long
>Dim sUser As String
>
>'Try to retrieve the information with a default
>' size
>sUser = Space$(INITIAL_GUESS)
>nLength = Len(sUser)
>hReturn = WNetGetUser(vbNullString, sUser, nLength)
>If hReturn = ERROR_MORE_DATA Then
> 'If there is too much data to fit into the
> ' default, then try the new length.
> sUser = Space$(nLength)
> hReturn = WNetGetUser(vbNullString, sUser, nLength)
>End If
>
>If hReturn = NERR_Success Then
> 'Retrieved a good user id
> LogonName = UCase$(StripNull(sUser))
>End If
>
>End Function
>
>Debug.Print LogonName()
>
>But if you want to stamp records in your database, your best choice is
>to do it on the server.
>
>For instance, in Oracle, you'd use a trigger add set the relevant
>fields like this:
>
> :new.userstamp := substr(user,1,8);
> :new.timestamp := sysdate;
>
>Ciao, Craig
>Thanks criag.I am able to get netuser id.
I wnat to generate a text file from the data that is enterd in the controls
of the form.Please help me how to generate the text file i n aparticular
format from the front data entered .
Thanku
kumar
