I have combobox problem

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, I have combobox problem...
I have combo source linked to table and when i load the form i can see the text but when i try to refer to combo value it returns the row number and not the text....why?

My table values
1. Jan
2. Feb
3. mar

I want the month name and not row/record number...

Thanks in advance for helping....
Pedie
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
What's the row source for the combobox?
 
Upvote 0
What's the row source for the combobox?

It it table called Months
it looks like this...
Code:
[/FONT]
[FONT=Courier New]SELECT [Months].[ID], [Months].[MyMOnths] FROM Months;

Also one more thing i want my combo values to be all unique values, no duplicates...

Thanks Norie
 
Upvote 0
Why are you including MonthID if you don't want it?

You could try removing it:

SELECT DISTINCT [Months].[MyMOnths] FROM [Months]

Not sure if that's what you want though.

Do you just want a combobox with Jan, Feb, Apr, May... Dec?
 
Upvote 0
Norie, you can say..i do not know anything yet in access:)....

I tried this and now the value returned is blank in my Combobox

Please advice.

Pedie


Why are you including MonthID if you don't want it?

You could try removing it:

SELECT DISTINCT [Months].[MyMOnths] FROM [Months]

Not sure if that's what you want though.

Do you just want a combobox with Jan, Feb, Apr, May... Dec?

 
Upvote 0
Try this.

Delete the existing combobox.

Check the control wizard is turned on:

Access 2010 (and 2007) - click the dropdown arrow to the right of all the controls in the Controls section of the main toolbar and select Use Control Wizards.

Earlier versions - check the small wand on the Control Toolbox.

One you've done that add a combobox to the form and you'll be guided through by the wizard.

By the way, how are you getting the value from the combobox anyway?
 
Upvote 0
Norie, now it works cool! it was the small space i guess...
I tried new combobox and works perfect now...


Thanks again.

Try this.

Delete the existing combobox.

Check the control wizard is turned on:

Access 2010 (and 2007) - click the dropdown arrow to the right of all the controls in the Controls section of the main toolbar and select Use Control Wizards.

Earlier versions - check the small wand on the Control Toolbox.

One you've done that add a combobox to the form and you'll be guided through by the wizard.


By the way, how are you getting the value from the combobox anyway?

 
Upvote 0
What 'small space'?

I'm pretty sure I know why it didn't work, the combobox had been set to 2 columns with the first column hidden.

So you would only see the 2nd column, which is the month.

The reason it returns the ID is because the bound column is set to return that.
 
Upvote 0
Hi again, yep maybe not the spaces...
I deleted it and tried again...just pasted the line you provided in the source and it worked...
I also just realised we can use query for this combo...

Thanks again Norie.:)


What 'small space'?

I'm pretty sure I know why it didn't work, the combobox had been set to 2 columns with the first column hidden.

So you would only see the 2nd column, which is the month.

The reason it returns the ID is because the bound column is set to return that.

 
Upvote 0
Pedie

You are using a query.:)

This is a query:

SELECT DISTINCT [Months].[MyMOnths] FROM [Months]
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,480
Members
452,915
Latest member
hannnahheileen

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