Full Version: Add Additional Text Programatically to Text Box
UtterAccess Forums > Microsoft® Access > Access Forms
markey
Hello UA. I'm trying to add text to an existing textbox everytime a checkbox is "True" (checked).
e
txtTextBox
chkWarning1
chkWarning2
User clicks on "chkWarning1" and the current date stamp with "Warning1 Message" is added to "txtTextBox". 3 days later the user comes back to the record and clicks "chkWarning2"..... right below the "Warning1 Message" in "txtTextBox" would appear the current days timestamp with the "Warning2 Message" etc.
So basically, anyone know how to add text to a text box without overwriting what is currently there? Any links, suggestions, or code examples are much appreciated. Thanks!!!
Jack Cowley
Me.txtTextBox = Me.txtTextBox & " This is your first warning! " & Date
omething like that in the After Update event of the check box...
hth,
Jack
markey
This is what I had in mind, but won't the textbox be "overwritten" as soon as another checkbox is selected..... I need the text messages to accumulate.
Jack Cowley
The code takes the data that is the text box and adds the new data to it. Try it and see if you get what you want...
ack
markey
Thanks, the concept works great.........sorry I didn't try it out before responding. I'll tweak it with some conditional statements and it will work perfectly for my DB. Thanks again!!!
markey
Would you happen to know how to make the text start a new line when its added to the textbox?
e
This is your first warning!This is your first warning!

Would Look Like
This is your first warning!
This is your first warning!
Jack Cowley
This should do the trick:
e.txtTextBox = Me.txtTextBox & vbCrLf & " This is your first warning! " & Date
Jack
markey
aw ha, thanks again for all your help!!!!
Jack Cowley
You are most welcome!!! Continued success with your project...
ack
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.