|
-
Sep 14th, 2007, 01:48 AM
#1
Thread Starter
PowerPoster
Logging field changes by a User
Hi guys,
I need to log each change made to a field by a user. Fields such as Firstname,ID Number and so forth.
What would be the easiest way to accomplish this. I was thinking of having two UDT's. In the first UDT I would store all the information on the form load. In the second UDT I would store the information once the user clicks save, and the I would compare the corresponding values of both UDT's and log the changed ones.
Am I on the right track here. I'd love to get your opinions.
Regards,
Nitesh
-
Sep 14th, 2007, 02:15 AM
#2
Re: Logging field changes by a User
Depending on the data entry size (you mention Id's etc) you could duplicate the controls .Text in it's .Tag property at Form_Load. And then later compare what is in the controls .Text against its .Tag and do whatever.
(If Text1.Text = Text1.Tag Then ......)
-
Sep 14th, 2007, 02:59 AM
#3
Re: Logging field changes by a User
How about using .Tag as goes from Bruce's advice, and simply enable/disable the 'save' button? For example (if you have a control array of TextBox-es):
Code:
Option Explicit
Private Sub form_load()
fillTags
End Sub
Private Sub Text1_Change(Index As Integer)
If Text1(Index).Text <> Text1(Index).Tag Then
Command1.Enabled = True
End If
End Sub
Private Sub Command1_Click()
'save procedure here...
MsgBox "Saved!"
fillTags
End Sub
Private Sub fillTags()
Dim n As Long
For n = Text1.LBound To Text1.UBound
Text1(n).Tag = Text1(n).Text
Next n
Command1.Enabled = False
End Sub
That way the user always knows where he's at.
-
Sep 14th, 2007, 03:29 AM
#4
Thread Starter
PowerPoster
Re: Logging field changes by a User
Hi,
Would the tag property be able to accomodate multiple lines of data from a multiline textbox.
-
Sep 14th, 2007, 03:41 AM
#5
Re: Logging field changes by a User
Yep.
For what it's worth, how much data do you need to styore - noting you mention username, ID's etc?
-
Sep 14th, 2007, 03:45 AM
#6
Thread Starter
PowerPoster
Re: Logging field changes by a User
Thanks guys,
I have 25 textboxes on the current tab but I have to do this for each tab and I have about 9 tabs. So there's quite alot
-
Sep 14th, 2007, 03:59 AM
#7
Re: Logging field changes by a User
Sorry, the question is how much data (lines of text, number of characters) per control (textbox)?
I think the .Tag can store about 64k.....
-
Sep 14th, 2007, 04:13 AM
#8
Thread Starter
PowerPoster
Re: Logging field changes by a User
oh ok,
for fields such as medical details dor example i have a multiline texbox, data could be a few lines or 1 word. For surnames and stuff I would be just storing a few characters.
-
Sep 14th, 2007, 04:15 AM
#9
Re: Logging field changes by a User
BTW, The .Tag property may not be included in VB.Net. So if in future if you choose to port you app to VB.Net it may fall over! - some reserach required 
Anyone ??
-
Sep 14th, 2007, 04:23 AM
#10
Re: Logging field changes by a User
What are you doing with the data in the 25 textboxs?
Are you storing that in a back end db?
-
Sep 14th, 2007, 04:32 AM
#11
Thread Starter
PowerPoster
Re: Logging field changes by a User
yes hack, that is correct.
-
Sep 14th, 2007, 05:11 AM
#12
Re: Logging field changes by a User
Then instead of fooling around with the textboxs, why not just keep track of who made database changes?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|