+ Reply to Thread
Results 1 to 10 of 10

Validating Item Numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    10-20-2012
    Location
    salinas, ca
    MS-Off Ver
    Excel 2010
    Posts
    25

    Validating Item Numbers

    Good Day Forum,

    I come to you to ask for your help solving the following problem:

    I have a simple userform that will help the user enter a list of items into a worksheet. The user would select a group from a combobox (groups are: breads, meats, cheeses, veggies) then use a textbox to enter the item number. Each group has about 20 or so items, each with a unique item number. The problem that I need your help solving is that I need a way to validate the item number being enter into the textbox so that the user doesn't enter a number that doesn't belong to that group. In other words... how can I stop the user from entering a number that doesn't belong to the group selected in the combobox?

    I was hoping to check the item number in an _AfterUpdate() event for the textbox but I don't know where or how to start the validation process for the item number.

    Any help you can provide will be appreciated!

    And thanks for your time!

    Julian

  2. #2
    Registered User
    Join Date
    10-20-2012
    Location
    salinas, ca
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Validating Item Numbers

    Hello again...

    I've been trying to use a vlookup function to see if I could validate the item number on the form but I'm getting stuck... the number is not being validated at all. I'm attaching a sample of the file I'm working on to see if anyone of you can tell me what I did wrong... or what I'm missing that is causing the problem. Please let me know if anyone has any suggestions or comments that would help find a solution.

    And thanks again for any help anyone can provide.

    Julian
    Attached Files Attached Files

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Validating Item Numbers

    Does it have to be a textbox? perhaps another ComboBox that only contains items from the 'category' that is chose?

    Edit:

    Comboboxes can be setup to be drop down only or have the ability for someone to type into them.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Validating Item Numbers

    Hello Julez80s,

    Have a look at the attached workbook.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Validating Item Numbers

    Test1 (1).xlsm

    Not completely tested.

  6. #6
    Registered User
    Join Date
    10-20-2012
    Location
    salinas, ca
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Validating Item Numbers

    Thank you both for the replies...

    XeRo,
    I thought about making a listbox or another combobox, as you suggested, but the problem with that is the item list will keep growing, and searching for the item number to select it will take longer than actually typing it in. The purpose of the form is to let the user finish the data input as fast and as accurately as possible. The file you posted doesn't seem to do anything... other than what I had been dealing with. When I choose an item from the Group combobox and enter the Item Number the same problem happens and the number doesn't get validated; the form either stops with the warning message or it doesn't do anything at all.

    Leith,
    The file you posted brings up a lot of empty boxes or what looks like part of the spreadsheet inside the listbox when I select one of the items from the Group combobox, but the item that I'm able to select from the listbox is not a number but text... and it doesn't get validated either.

    Another problem with the combobox idea is that if the user is able to type the number in the field then the user could type the wrong item number as well... there would have to be a way to validate the item number against the group.

    Again, thank you both for taking the time to look at my problem... and please let me know if you have any other ideas on this one.

    Julian
    Last edited by Julez80s; 07-05-2013 at 02:10 AM.

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Validating Item Numbers

    The combo boxes I included on my solution remove all items once a new category has been selected. Test it and see if you think that will still be a problem.

  8. #8
    Registered User
    Join Date
    10-20-2012
    Location
    salinas, ca
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Validating Item Numbers

    Sorry Xero... maybe I'm looking at a different file, but the one posted under your name doesn't have any comboboxes at all... could you take a look at the file and let me know?

    Thanks!

  9. #9
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Validating Item Numbers

    My mistake. I attached the wrong file. Here is the correct one.

    I also added a close button to be able to close the userform a little easier.

    Test1.xlsm

  10. #10
    Registered User
    Join Date
    10-20-2012
    Location
    salinas, ca
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Validating Item Numbers

    XeRo,

    Thank you for the file... and the solution; I can use it to get me started and wait to see if the list length doesn't become a problem later on. I had to make a couple of changes to your solution but it's working great.

    Thanks again!

    Julian

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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