Results 1 to 12 of 12
  1. #1
    3 Star Lounger
    Join Date
    Jun 2003
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change Control (Access 2003)

    Hey, I currently have a timestamp for when a record is created. Is there any way to add a field that displays the date and time of the last time the record was edited?

  2. #2
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    You can not track that info in tables...do you wish to track *all* changes to the record, or just to a specific field/fields?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  3. #3
    3 Star Lounger
    Join Date
    Jun 2003
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    I was hoping to track any changes?

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change Control (Access 2003)

    Hi there, this is possible

    Here is a good tutorial and sample database
    Jerry

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    Okay, well my best suggestion to you if you wish to allow the "table" view is to display a form in datasheet view. This isn't particularly hard, let me find the example, and I'll show you how. There are plenty of examples of creating a change LOG around the lounge, however what you want to do is a lot simpler. This little tidbit is assuming your last modified field is named "LAST_MODIFIED"...Try this:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Me!LAST_MODIFIED=Now()
    End Sub

    The only problem is that this doesn't differentiate between whether an actual change was made or not. If you want to know if a change was made, let me know, as well as if you want to know what was changed, old value, new value, etc...
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  6. #6
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change Control (Access 2003)

    Jeremy

    Whilst agreeing with you, I think in this situation that a seperate table is justified that will populate as and when the master form has changes made to it, this will allow an audit trail of changes, the code in the link above can be modified to suit. I just talk from experience when I have fields go awry my <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15> worth
    Jerry

  7. #7
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change Control (Access 2003)

    By Jove we will
    Jerry

  8. #8
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    <P ID="edit" class=small>(Edited by NYIntensity on 15-Aug-05 23:08. Edited....I think joe appreciates the acknowledgment, but Jove was more deserving [evilgrin])</P>And I agree with you. I think it is *much* easier to undo a data-entry clerk's mess when you know what they did in the first place (I track *everything*, so a simple update query will reset most values to a time which I specify)....I recently used a bit of code off here to track all changes made in my database on a datasheet form, I was ecstatic to finally get it working. Up to now, I'd been very reluctant to allow users any sort of "table" view, because I'd only known how to use the after update event for individual fields (what a PITA that was).... We'll see what he wants to do, if he wants to track *everything*, then by jove, we'll do it <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  9. #9
    3 Star Lounger
    Join Date
    Jun 2003
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    If I just have a general password for the db, is there any way for access to realize the user who is in the DB?
    Thanks

  10. #10
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    There sure is. I know this works when logging in to the network, though I'm pretty sure it will work even if not on a network. Copy and paste this into a new module, name it something obscure, like 'IknowU' or something like that...it can't be GetNetUser.

    Option Compare Database

    Private Declare Function WNetGetUserA Lib "mpr.dll" _
    (ByVal lpszLocalName As String, ByVal lpszUserName As String, lpcchBuffer As Long) As Long


    Public Function GetNetUser() As String
    Dim lpUserName As String, lpnLength As Long, lResult As Long
    'Create a buffer
    lpUserName = String(256, Chr$(0))
    'Get the network user
    lResult = WNetGetUserA(vbNullString, lpUserName, 256)
    If lResult = 0 Then
    GetNetUser = Left$(lpUserName, InStr(1, lpUserName, Chr$(0)) - 1)
    Else
    GetNetUser = "-unknown-"
    End If
    End Function

    You refer to this like this
    Me.EditedBy = GetNetUser()
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  11. #11
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Change Control (Access 2003)

    Jeremy is correct for DB with users on network, can we assume that is correct?
    Jerry

  12. #12
    3 Star Lounger
    Join Date
    Jun 2003
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Control (Access 2003)

    yes the db is on a network.
    Thanks all, i will play with.
    much appreciated!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •