StrataFrame Forum

Limit input into a bound Textbox

http://forum.strataframe.net/Topic25229.aspx

By Terry Bottorff - 11/17/2009

The following is the definition of the field in the database: [Event] [char](2) NOT NULL, and the following is what I have as the default in the database: DEFAULT ('') FOR [Event].



How do I limit the user from entering only CC in the bound text box on a form or leaving it blank? If the user enters anything else I want to set it back to '' and return to the input form.



I have tried using the CheckRulesonCurrentRow like the following but it does not seem to work:



if me.sportbo.event <> "CC" and me.sportbo.event <> "" THEN

return False

endif



I have also tried me.sportbo.event <> " " AND me.sportbo.event <> " " (one space and two spaces between the "").

I also tried me.sportbo.event <> string.empty



It should be easy I think. TIA






By Edhy Rijo - 11/17/2009

Terry Bottorff (11/17/2009)
How do I limit the user from entering only CC in the bound text box on a form or leaving it blank? If the user enters anything else I want to set it back to '' and return to the input form.


Hi Terry,



There are many ways to do this, but if they can only enter some specific data, then use a ComboBox and either preset the values or use a lookup table.
By Terry Bottorff - 11/17/2009

Makes sense thank you.
By Edhy Rijo - 11/17/2009

Also if you don't mind using an Integer field instead of Character, you can create a Public Enum with the values allowed and bind the combobox to that Enum and that will take of the problem. I do that all the time for very short lookup options.
By Terry Bottorff - 11/17/2009

Alright I'll think about that. Thanks.