Combo box based on option group

User avatar
JudyJones
StarLounger
Posts: 72
Joined: 08 Mar 2010, 13:05
Location: Manassas, VA

Combo box based on option group

Post by JudyJones »

I have a combo box named cmbStuLookup based on an option group. I currently have the combo box displaying the lookup based on last name if they select that option or first name if that option is selected. The row source changes based on the selected option. That works fine but now I want to add a third option of student #.

This second column is set to 0 for the current options so I need to change the column widths when this option is selected. I tried to use:
Me.cmbStuLookup.ColumnWidths = 0";0";0.75";0.75";1.25";0.75";0.75"
if option 1 or 2 is selected

and then change the code to
Me.cmbStuLookup.ColumnWidths = 0";.5";0.75";0.75";1.25";0.75";0.75"
if option 3 is selected.

However, I get a compile error: expected end of statement.

What do I have to change to make this work?

User avatar
HansV
Administrator
Posts: 78594
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Combo box based on option group

Post by HansV »

ColumnWidths is a string, so the value should be enclosed in quotes. Quotes within a quoted string must be doubled:

Me.cmbStuLookup.ColumnWidths = "0"";0"";0.75"";0.75"";1.25"";0.75"";0.75"""
Best wishes,
Hans

User avatar
JudyJones
StarLounger
Posts: 72
Joined: 08 Mar 2010, 13:05
Location: Manassas, VA

Re: Combo box based on option group

Post by JudyJones »

Thanks. I would never have worked that out. I tried a double quote at the beginning and end and then I tried single quotes combined with double quotes but following your example it worked great.