+ Reply to Thread
Results 1 to 9 of 9

Check that input in textbox is an integer

  1. #1
    Registered User
    Join Date
    08-02-2007
    Posts
    30

    Check that input in textbox is an integer

    How do I check that the text written in a textbox is an integer value (and not for example string or other type)?

    Additionally, is it possible to make a textbox "locked" to a certain input format such that it is just possible to write dates in the form xxxx-xx-xx (for example 1987-01-03) in to the textbox?

    Thx for help.

    Regards,


    Marcus

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Use the Exit_Event of the TextBox

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-02-2007
    Posts
    30

    This helped!

    Thx,

    helped perfectly OK. Do you by chance also know the answer to the second question in my message?

    Regards,


    Marcus

    Quote Originally Posted by marcusr
    How do I check that the text written in a textbox is an integer value (and not for example string or other type)?

    Additionally, is it possible to make a textbox "locked" to a certain input format such that it is just possible to write dates in the form xxxx-xx-xx (for example 1987-01-03) in to the textbox?

    Thx for help.

    Regards,


    Marcus

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You can't, but you could adapt the previous code

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-02-2007
    Posts
    30

    Close enough!

    This solution is good enough.

    Once again Thanks!


    Marcus

    Quote Originally Posted by royUK
    You can't, but you could adapt the previous code

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    09-25-2007
    Posts
    20
    Quote Originally Posted by royUK
    Use the Exit_Event of the TextBox

    Please Login or Register  to view this content.
    This works great, but I have approximately 20 input textboxes on my form. Is there a way to write a small block of code that looks at all the textboxes? Otherwise I will have to copy/paste this 20 times, then go through each one if I have to change the error parameters.

    Thanks!

  7. #7
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    Well the simple way is to create the code as a sub, the just call the sub in the textbox_exit click

    Regards

    Dav

  8. #8
    Registered User
    Join Date
    09-25-2007
    Posts
    20
    Simple is always the best, I don't know why I didn't think of that.

    Thanks!

  9. #9
    Registered User
    Join Date
    09-25-2007
    Posts
    20
    what member would I use for the 'with me.textbox1' section of code to make it applicable for every textbox on my form?

    Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1