Auto date and user name in a textbox
Hi, i have a textbox in my MS Access 97 form where different users can enter comments, however we can't track when and by whom. How can i add the date and the user name automatically everytime when the user click on the textbox and by keeping the previous comments in that textbox. Thanks
Re: Auto date and user name in a textbox
you want to add fields to table to store date and user, or add to textbox text?
in the click event
VB Code:
textbox.text = Now & " " & user & " " & textbox.text
pete
Re: Auto date and user name in a textbox
The data from txtComments textbox is stored in my database (Comments) as a note field. So when i load the form, a user can add new comments below the previous comments.
Re: Auto date and user name in a textbox
VB Code:
database(comments) = database(comments) & now & " " & user & vbnewline & txtcomments
should do the trick
pete
Re: Auto date and user name in a textbox
thanks its working. how can i make the text permanent that is the user can't erase the date and username.
Re: Auto date and user name in a textbox
use separate textboxs to display and add, don't save changes to the display one
pete
Re: Auto date and user name in a textbox
use separate textboxs to display and add
txtdisplaytext locked property: Yes
VB code:
txtaddtext_AfterUpdate
txtdisplaytext=txtdisplaytext & now & " " & user & vbnewline & txtaddtext
end sub
then save txtdisplaytext to your database
Re: Auto date and user name in a textbox
i'm getting this error -
" You can't reference a property or method for a control unless the control has the focus. I changed the txtAdd.setfocus i'm still getting the same error.
VB Code:
Private Sub txtAdd_AfterUpdate()
txtDisplay.SetFocus
txtDisplay.Text = txtDisplay.Text & vbNewLine & vbNewLine & Now() & " " & vbNewLine & CurrentUser() & vbNewLine & txtAdd.Text
End Sub
Re: Auto date and user name in a textbox
is txt display locked or otherwise disabled?
Re: Auto date and user name in a textbox
the form is set up in a way that all the controls are locked therefore only viewing. If you need to modify then click the user has to click on the 'Edit' button to enable all the controls.
Re: Auto date and user name in a textbox
is the txtdisplay still locked when you try to upate it, or are all the controls unlocked after edit is clicked?
Re: Auto date and user name in a textbox
all the controls are unlocked after the edit button is clicked
Re: Auto date and user name in a textbox
are these textboxs bound to the data?
if so update the table/database the textbox should display