Inserting Too Much Text Into A Text Box

RockyAndNickels

Lil' Programming Dude
Local time
Today, 11:54
Joined
Jan 14, 2007
Messages
11
I am creating a form with a text box that has buttons that insert a phrase when clicked. My concern is that I'm afraid of clicking it to many times and having to go into the text box to clear it out.

My question is this: Can I prevent this from happening?

Also, is there a way for me to use a toggle button to insert this text?
 
You could use almost any control to do what you want, including a Toggle Button. Maybe if you described what you are doing we could offer some suggestions.
 
The database that I am creating is for my Magic The Gathering cards. Some creature cards have certain abilities, like flying or being able to block those who fly.

I want to create a button (or a toggle button) that when clicked on (or toggled on) will insert a specific text string into a text box that's linked to a table I have created.

I would also like to have the ability to, if the button is clicked again (or toggled off) will take out that same text string.
 
Maybe each string should be a separate record in a table (temporary maybe). Putting the string in a textbox is eazy. Getting it back out is quite a bit more difficult. When you are satisfied with the results then the temp table could be placed in a TextBox if that is what you want. You have some decisions to make here.
 
First, to answer your last question, "Yes" you can use a option buttons. Just create a frame control and place as many option buttons in this control as you need, labeling each one to indicate the phrase that is to be written to the text box when that option is selected.

You can set the default value of the frame control to zero so that for new records, no selection is premade.

Then in the After Update event of your frame control, use a Case Statement to write the selected value to your text box.

Select Case Me.NameOfFrameControl
case 1 'this should correspond to the option button with the value of 1
Me.txtNameOfTextBox.value = "your preset string"
case 2 'this should correcpond to the number 2 option button
'additional case statements go here
End Select

This will cause whatever is already in the text box to be replaced.

HTH
 
Last edited:
Thanks for the reply Mr. B.

Now, here's my next problem (which I forgot to mention). There are several options that the user will select for each card and sometimes the card will require more than one option (i.e. the card will have Flying and Trample). With the current Case Statement, I'm not able to do both because once I select the second option to insert, the whole thing is replace. How am I able to do more than one option?
 
Not that you are indicating that you actually want more than one entry, this now sounds like a one-to-many relationship. It also sounds like you are wanting to place more than one value in one field.

You may want to revisit your database design. It may be possible that you now need a table to store multiple selections.

If you take this approach, you can present these options to your users from a list box of possible selections and have another list box that displays the currently selected statements. You could then use command buttons (like the ones you see between two list boxes) to move records from one list to the other. Also, using this method, you can prevent users from duplicating statements.

Just my thoughts.
 

Users who are viewing this thread

Back
Top Bottom