Combo Box Data Format

D

David

Here is a bit of a head scratcher...

I have a combo box whose data source is an SQL statement I build in code.

Part of the SQL statement uses the Format function to make the data in the
list Yes or No. The Syntax of the data source is:
SELECT Format([fieldname], "Yes/No") FROM table GROUP BY [fieldname]

When I select the drop down, the data shows up as expected (Yes or No).

When I make a selection, the data reverts to -1 or 0.

Any ideas how I can keep the selection to be what I selected? (Yes or No)??

Thanks.
 
K

KARL DEWEY

Open form in design view, click on combo, right click on combo, set the
format in the properties.
 
D

David

Hi Karl,

Thanks for your reply.

I "could" do as you suggest, but I need to do this in code, as there are
other data types I need to account for, and as such, need to set the .FORMAT
value in code.

What I found through trying different options is that if I use the "@"
format, the combo box retains the value I select (Yes or No), it that format,
and does not revert it to -1, or 0.

So, I think I'm good to go.

Thanks again.
--
David


KARL DEWEY said:
Open form in design view, click on combo, right click on combo, set the
format in the properties.
--
KARL DEWEY
Build a little - Test a little


David said:
Here is a bit of a head scratcher...

I have a combo box whose data source is an SQL statement I build in code.

Part of the SQL statement uses the Format function to make the data in the
list Yes or No. The Syntax of the data source is:
SELECT Format([fieldname], "Yes/No") FROM table GROUP BY [fieldname]

When I select the drop down, the data shows up as expected (Yes or No).

When I make a selection, the data reverts to -1 or 0.

Any ideas how I can keep the selection to be what I selected? (Yes or No)??

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top