Multiple textbox validation & tab order

  • Hello. I have a form with around 50 textboxes.


    Firstly, is there a quick way to set the tab order so that it is automatically in sequence, rather than having to go through each one manually?


    Secondly, is there a quick way to validate all 50 in one go? I want to ensure that only numbers 0-9 are entered in each textbox. Previously, I've used a validation script on a single textbox using KeyPress & Ascii codes 48-57, but I don't know if this can be adapted for multiple textboxes.


    Thanks in anticipation.


    Stephen

  • Re: Multiple textbox validation & tab order


    Thanks norie. Tab Order is fine, should have spotted that. Re 2nd point, I've looked at your example which doesn't work on my form but I'm looking into that. I owe you two!

  • Re: Multiple textbox validation & tab order


    norie,
    Apologies for reviving this long after it's probably slipped from your mind but I am having trouble understanding your attachment. I've just tried to get it to work on my form, exactly as it stands, but nothing happens. There's no error, but it doesn't stop me from entering non-numeric data. Any idea why this might be?
    Help from anyone at all welcome of course. Thanks. The code is as follows:



    Class Module


  • Re: Multiple textbox validation & tab order


    Stephen


    In my example you'll notice that this isn't in a sub.

    Code
    Dim TextBoxes() As New CTextboxes


    Useform module.

  • Re: Multiple textbox validation & tab order


    Thanks norie. Believe it or not I spotted that and changed it and I could have sworn I got an error message but I must have done something wrong. Thanks a lot. Btw what's the significance of placing it outside a sub?

  • Re: Multiple textbox validation & tab order


    To be honest I don't rightly know.:)


    It's probably something to do with scope, placing it in the sub means it's only available within that sub.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!