Setting Limits in A Textbox

ddrew

seasoned user
Local time
Today, 19:00
Joined
Jan 26, 2003
Messages
911
I thought that I had solved this but it seems not!

I have a textbox called Odours, there are four buttons below the textbox btn_Cadaver, btn_Drugs, btn_Explosives and btn_Money.

On licking one of the buttons a value will be put in he textbox
i.e. pressing the btn_Cadaver will put the value "Cadaver ()" in the textbox.

The reason I want this is that all of the entries must begin with either Cadaver, Drugs, Explosives or Money. The brackets are there to allow the user to put some free text between the brackets.

I have some code to set the cursor (on click) between the brackets

Code:
Me.Breed.SelStart = 9

I want to prevent the user from typing anywhere in the textbox except between the brackets.
 
Just my thoughts, but I think it may be better to allow the user to make their entry and then add the required prefix word and brackets with code in the Before Update event of the text box. I would also set the enabled property of the text box to No and put a list box on the form (to replace the four buttons) which could enable the text box once a selection has been made.
 
Just my thoughts, but I think it may be better to allow the user to make their entry and then add the required prefix word and brackets with code in the Before Update event of the text box. I would also set the enabled property of the text box to No and put a list box on the form (to replace the four buttons) which could enable the text box once a selection has been made.

I get what you mean Bob, I'm not sure how to add the detail afterwards with code though!
 
Something like:
Me.ActiveControl = Me.ListboxName.Value & "(" & Me.ActiveControl & ")"
 

Users who are viewing this thread

Back
Top Bottom