+ Reply to Thread
Results 1 to 5 of 5

Use VBA code to display message if combobox selection not in list

Hybrid View

Guest Use VBA code to display... 12-29-2005, 05:55 PM
Guest Re: Use VBA code to display... 12-29-2005, 06:40 PM
Guest Re: Use VBA code to display... 12-29-2005, 06:55 PM
TJS Hi, It won''t convert the... 12-29-2005, 07:20 PM
Guest Re: Use VBA code to display... 12-29-2005, 07:40 PM
  1. #1
    Dave Peterson
    Guest

    Re: Use VBA code to display message if combobox selection not in list

    Change the style of the combobox to fmStyleDropdownList (2).

    hurlbut777 wrote:
    >
    > When using combo box to display drop-down list, users can actually type in
    > any value they want...not good for what I need. A feasible fix for this is
    > to verify that the value typed in the combo box is in a list...if it isn't
    > display a message that says Try Again.
    >
    > Based on the list below, what would the VBA code look like that says if
    > combo box value is not in list then give error message?
    >
    > List: Monday, Tuesday, Wednesday


    --

    Dave Peterson

  2. #2
    hurlbut777
    Guest

    Re: Use VBA code to display message if combobox selection not in l

    Other than converting the combobox to the form style...any help on the code
    below?

    Thanks

    "Dave Peterson" wrote:

    > Change the style of the combobox to fmStyleDropdownList (2).
    >
    > hurlbut777 wrote:
    > >
    > > When using combo box to display drop-down list, users can actually type in
    > > any value they want...not good for what I need. A feasible fix for this is
    > > to verify that the value typed in the combo box is in a list...if it isn't
    > > display a message that says Try Again.
    > >
    > > Based on the list below, what would the VBA code look like that says if
    > > combo box value is not in list then give error message?
    > >
    > > List: Monday, Tuesday, Wednesday

    >
    > --
    >
    > Dave Peterson
    >


  3. #3
    Registered User
    Join Date
    12-12-2005
    Posts
    8
    Hi,

    It won''t convert the combobox. Just change its behavior.

    But anyway, can use MatchRequired and then If MatchFound on change event.

    TJ

  4. #4
    Dave Peterson
    Guest

    Re: Use VBA code to display message if combobox selection not in l

    dim myArr as Variant
    myArr = array("Monday","Tuesday","Wednesday")

    if iserror(application.match(me.combobox1.value,myarr,0)) then
    'not a match, the board goes back
    else
    'do what you want
    end if

    But changing the .style is too easy to ignore.

    hurlbut777 wrote:
    >
    > Other than converting the combobox to the form style...any help on the code
    > below?
    >
    > Thanks
    >
    > "Dave Peterson" wrote:
    >
    > > Change the style of the combobox to fmStyleDropdownList (2).
    > >
    > > hurlbut777 wrote:
    > > >
    > > > When using combo box to display drop-down list, users can actually type in
    > > > any value they want...not good for what I need. A feasible fix for this is
    > > > to verify that the value typed in the combo box is in a list...if it isn't
    > > > display a message that says Try Again.
    > > >
    > > > Based on the list below, what would the VBA code look like that says if
    > > > combo box value is not in list then give error message?
    > > >
    > > > List: Monday, Tuesday, Wednesday

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

+ 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