Forcing Numeric Input in SalesLogix Fields

Often times, you need to force a particular type of input to a SalesLogix field.  There are a couple ways to do this: If the control is mapped to an numeric database field, an error will be displayed stating that alpha characters are not allowed; otherwise, you can set the format type of the control to ftInteger, but that will not prevent alpha entry.  It will only prevent any non-numeric values from being displayed (any non-numeric value would display as ‘0’).

The method I use frequently, is to evaluate the key pressed in the control, and set the control to readonly based on what is being entered…

Adding this code to a text boxes KeyPress event will force the control to only accept numeric input.

Sub TextBox1KeyPress(Sender, ByRef Key)

     if (key < 48 or key > 57) and key <> 46 and key <> 127 and key <> 8 then

     sender.readonly = true


     sender.readonly = false

     end if


End Sub


This code could be modified to exclude any key from writing to the control, it would just be a matter of determining the key value for any key you want to exclude.


(I got this code from Kris Halsrud (thanks Kris!).  You can view his blog on integration at


Jason Buss

Jason is a senior application developer with Customer FX.

1 Comment

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!