If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
adding logged in user to text box
What I want to do though is keep a record of who has made changes within the notes part of the database. We would like to have a button on the form that when pressed would display the current user, the date and the current time within a textbox (Notes). Right now I am able to display the time, but the others (date and currentuser) are overwritten by the time. When I try to enter data into the database, it will let me add the text, but if I try to add the current date, time and user, it will overwrite anything that I have entered and display the time. Is there a way to display all three (date, time, and user) all at once and is it possible to press the butoon to get these displayed, add text and then say 2 days later, go back into the database press the button, have the time, date, and user added to the end of the info previously inputted into the textbox, then add more text. All within the same record, instead of having to start a new record for the same customer? This way, we can have multiple entries in the one textbox (Notes). For example the one textbox, it may look like this.
Quote: -------------------------------------------------------------------------------- Dennis June 12th, 2004, 10:30am ' first entry text here Dennis June 20th, 2004, 1:00pm ' second entry text here Dennis July 1st, 2004, 3:15pm ' third entry text here -------------------------------------------------------------------------------- This is all in one textbox. Thanks Dennis |
#2
|
|||
|
|||
adding logged in user to text box
I am not sure why you'd want to do this on a button press. What if the user
does not press the button? You should simply write the timestamp anytime the data is changed. If you want to only track the most recent change, you'd just place the data in a field. something like... Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.Dirty Then If (Nz(Notes.OldValue, 0) Nz(Notes.Value, 0) Then Me.Timestamp = Format(CurrentUser, "") & " " & date & " " & Time End If End If End Sub If you want to retain an audit trail, there are examples out there on the web. I know Allen Browne has some code on his website that does it nicely. Rick B "dennis" wrote in message ... What I want to do though is keep a record of who has made changes within the notes part of the database. We would like to have a button on the form that when pressed would display the current user, the date and the current time within a textbox (Notes). Right now I am able to display the time, but the others (date and currentuser) are overwritten by the time. When I try to enter data into the database, it will let me add the text, but if I try to add the current date, time and user, it will overwrite anything that I have entered and display the time. Is there a way to display all three (date, time, and user) all at once and is it possible to press the butoon to get these displayed, add text and then say 2 days later, go back into the database press the button, have the time, date, and user added to the end of the info previously inputted into the textbox, then add more text. All within the same record, instead of having to start a new record for the same customer? This way, we can have multiple entries in the one textbox (Notes). For example the one textbox, it may look like this. Quote: ---------------------------------------------------------------------------- ---- Dennis June 12th, 2004, 10:30am ' first entry text here Dennis June 20th, 2004, 1:00pm ' second entry text here Dennis July 1st, 2004, 3:15pm ' third entry text here ---------------------------------------------------------------------------- ---- This is all in one textbox. Thanks Dennis |
#3
|
|||
|
|||
adding logged in user to text box
Thanks Rick, appreciate it.
Dennis |
#4
|
|||
|
|||
adding logged in user to text box
What I want is to track all changes to the database. This is why I would like to have it in the format I sent earlier. I'm just not sure how to go about it. So you think that using a timestamp would work, will this allow for multiple entries? And will it place it at the end of the already existing text? I have seen this before in other software, but never in Access, so I assume that it can be done.
Any more ideas? Dennis |
#5
|
|||
|
|||
adding logged in user to text box
On my website (see sig below) are two small sample databases that illustrate
how to create an audit trail. They are "AuditTrail.mdb" and AuditTrail2.mdb" (oddly enough). AuditTrail is simpler of the two, while AuditTrail2 adds complications like multiple users. -- --Roger Carlson www.rogersaccesslibrary.com Reply to: Roger dot Carlson at Spectrum-Health dot Org "dennis" wrote in message ... What I want is to track all changes to the database. This is why I would like to have it in the format I sent earlier. I'm just not sure how to go about it. So you think that using a timestamp would work, will this allow for multiple entries? And will it place it at the end of the already existing text? I have seen this before in other software, but never in Access, so I assume that it can be done. Any more ideas? Dennis |
#6
|
|||
|
|||
adding logged in user to text box
Dennis:
After rereading your post, one of our solutions would do what you want exactly. What I would do is... Build a form with all your data on it. Make the "Notes" field locked. Add a new unbound field called NewNote and a button called "ApendNote". In your OnClick, create code that verifies that the "NewNote" field is not null. If it is not, then do the following... Notes = Notes & Chr(10) & Format(CurrentUser, "") & " " & date & " " & Time & [NewNote] I have not tested this, so you may have to play a bit. But I think it will give you more of what you are looking for. sorry about the hasty response earlier. Rick B "Roger Carlson" wrote in message ... On my website (see sig below) are two small sample databases that illustrate how to create an audit trail. They are "AuditTrail.mdb" and AuditTrail2.mdb" (oddly enough). AuditTrail is simpler of the two, while AuditTrail2 adds complications like multiple users. -- --Roger Carlson www.rogersaccesslibrary.com Reply to: Roger dot Carlson at Spectrum-Health dot Org "dennis" wrote in message ... What I want is to track all changes to the database. This is why I would like to have it in the format I sent earlier. I'm just not sure how to go about it. So you think that using a timestamp would work, will this allow for multiple entries? And will it place it at the end of the already existing text? I have seen this before in other software, but never in Access, so I assume that it can be done. Any more ideas? Dennis |
#7
|
|||
|
|||
adding logged in user to text box
that shoulda said "none of our solutions would do what you want exactly"
"Rick B" wrote in message ... Dennis: After rereading your post, one of our solutions would do what you want exactly. What I would do is... Build a form with all your data on it. Make the "Notes" field locked. Add a new unbound field called NewNote and a button called "ApendNote". In your OnClick, create code that verifies that the "NewNote" field is not null. If it is not, then do the following... Notes = Notes & Chr(10) & Format(CurrentUser, "") & " " & date & " " & Time & [NewNote] I have not tested this, so you may have to play a bit. But I think it will give you more of what you are looking for. sorry about the hasty response earlier. Rick B "Roger Carlson" wrote in message ... On my website (see sig below) are two small sample databases that illustrate how to create an audit trail. They are "AuditTrail.mdb" and AuditTrail2.mdb" (oddly enough). AuditTrail is simpler of the two, while AuditTrail2 adds complications like multiple users. -- --Roger Carlson www.rogersaccesslibrary.com Reply to: Roger dot Carlson at Spectrum-Health dot Org "dennis" wrote in message ... What I want is to track all changes to the database. This is why I would like to have it in the format I sent earlier. I'm just not sure how to go about it. So you think that using a timestamp would work, will this allow for multiple entries? And will it place it at the end of the already existing text? I have seen this before in other software, but never in Access, so I assume that it can be done. Any more ideas? Dennis |
#8
|
|||
|
|||
adding logged in user to text box
Rick,
Thanks. That sounds more like what I am looking for. Rick, I am on my way to check it out thanks. Thanks again, Dennis |
Thread Tools | |
Display Modes | |
|
|