ComboBox - Value enteres is not valid

cstimart

Well-known Member
Joined
Feb 25, 2010
Messages
1,180
I have a ComboBox on my form, with 2 option buttons. If the user selects option 1, the ComboBox fills the dropdown list (by changing the Row Source SQL) with week-ending dates that the user can select....and there's no error.

However, if the user selects option 2, the ComboBox fills the dropdown list (by changing the Row Source SQL) with 4 digit years. When the user selects one of those, the error appears.

'The value you entered isn't valid for this field.'

I've tried changing the 'Format' of the ComboBox based on the option without any luck.:oops:

Any ideas?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Would you not need to amend the format if you change the type of data for the control.
Not something I have ever needed to be done TBH.
 
Upvote 0
Duh, sorry, I just reread your original post, however when you say 'change the format' are you doing it on the fly when you change the record source?

When I have created comboboxes it has always been in the format
ID
Item to display
Other items needed

so I have always been putting the same type value in the control?

You could try that and then just refer to the second column(1) when you want to compare against that value.

I'd like to know if you ever sort it, as I can see it is the sort of thing I might need to do in the future, but I would still construct the data in the way I mentioned above.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,704
Messages
6,161,390
Members
451,701
Latest member
ckrings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top