473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Tack Changes II

Hello:

I already posted a question yesterday concerning that problem and got
help, however I was not able to fix it entirely. I want to track when
updates were made and who did it using the general networkID.
Here is what I did:

I created the following module:

'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************

Then I created the following procedure for my form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[ModifyDate] = Now
Me.[ModifiedByUser] = UserName
End Sub

Private Sub ModifiedByUser_AfterUpdate()
End Sub

Private Sub ModifyDate_AfterUpdate()
End Sub

I get the ModifyDate, but not ModifiedByUser, I appreciated any
suggestions

Thanks a lot Nicole
Nov 12 '05 #1
7 1353
In your Form_BeforeUpdate, you are referencing something called "UserName".
If this is supposed to be the API you have listed at the top, the function
name is called "fOSUserName".

Mike Storr
www.veraccess.com

"Nicole" <nv****@gmx.de> wrote in message
news:72**************************@posting.google.c om...
Hello:

I already posted a question yesterday concerning that problem and got
help, however I was not able to fix it entirely. I want to track when
updates were made and who did it using the general networkID.
Here is what I did:

I created the following module:

'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If (lngX > 0) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************

Then I created the following procedure for my form:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[ModifyDate] = Now
Me.[ModifiedByUser] = UserName
End Sub

Private Sub ModifiedByUser_AfterUpdate()
End Sub

Private Sub ModifyDate_AfterUpdate()
End Sub

I get the ModifyDate, but not ModifiedByUser, I appreciated any
suggestions

Thanks a lot Nicole

Nov 12 '05 #2
Thanks for your quick response!

I already tried that and I知 getting a Compile error: Expected variable
or procedure, not module. I知 sorry; I知 really new in the Access field.

Thanks Nicole
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
On 27 Jan 2004 18:49:10 GMT, Nicole Voigt wrote:
Thanks for your quick response!

I already tried that and I知 getting a Compile error: Expected variable
or procedure, not module. I知 sorry; I知 really new in the Access field.

Thanks Nicole
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


I'm thinking that your code of
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[ModifyDate] = Now
Me.[ModifiedByUser] = UserName
End Sub

should read

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[ModifyDate] = Now
Me.[ModifiedByUser] = fOSUserName
End Sub

--
Mike Storr
veraccess.com
Nov 12 '05 #4
I'm sorry, I tried that too and it won't work, I get still the compiling
error. Thanks Nicole
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5
When you get the compile error, it should indicate what line is causing it.
If you could post that this may make more sense.
"Nicole Voigt" <nv****@gmx.de> wrote in message
news:40***********************@news.frii.net...
I'm sorry, I tried that too and it won't work, I get still the compiling
error. Thanks Nicole
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #6
Thanks for your help, the problem was that I named the module like my
variable and that of course would not work. Thanks a lot Nicole

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #7
Look to see if you have a module called fOSUserName, if you have change the
name to (e.g. modOSUserName) something else

Terry
"Nicole Voigt" <nv****@gmx.de> wrote in message
news:40***********************@news.frii.net...
I'm sorry, I tried that too and it won't work, I get still the compiling
error. Thanks Nicole
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: robmcdan | last post by:
Hi, I'm using RegNotifyChangeKeyValue() (via DllImport) to detect changes to registry keys and subkeys. However, in addition to catching changes, I would like to know what the changes were. ...
4
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
0
by: Jeff Reed | last post by:
I am experiencing the the problem outlined the below. Unfortunately, I am using WinXP and I not sure if I can apply the solution due to lack of security control Any feed back would be apreciated ...
9
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
6
by: lanem | last post by:
I have a page that shows some data in a datagrid. All rows are updateable and then the changes are saved by hitting the "Save Changes" button. It is not a row by row save. All edits are made and...
16
by: Richard | last post by:
Hi, I am passing a structure to a subroutine where the passed parameter has been declared as ByVal. However, changes made to the passed variable inside the subroutine flow through to the...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
5
by: vovan | last post by:
I have set of controls (Textboxes, checkboxes etc) along with the Grid on Windows Form. I use BindingSource to populate both Grid and the set of Controls. User selects the record in the grid and...
11
by: gyap88 | last post by:
Hello i m using vb 2005 express to do my project. I m suppose to create a datagrid to allow user to make changes to the database. The program display the database in a datagrid where users can juz...
0
by: Cruxic | last post by:
Is it possible to tack on arbitrary attributes to a python object? For example: s = 'nice 2 meet you' s.isFriendly = True In the above example Python complains on the second line with: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.