choose function

I

iccsi

I would like to use choose function from dropdown box column 4.
for example:

Choose([myform[![mydropdown]![column](4), myvalue = "something",
myvalue = "that thing")
Can I do above using choose function?
If I can, can you please advise the proper syntax?
If not, any other solution for this?


Your help is great appreciated,
 
T

Tom van Stiphout

On Wed, 19 May 2010 07:37:48 -0700 (PDT), iccsi <[email protected]>
wrote:

Choose(Me.myDropdown.Column(4), "TextForIndex0", "TextForIndex1",
"TextForIndex2, ...etc)

-Tom.
Microsoft Access MVP
 
D

Daryl S

icssi -

If the fourth column of your drop-down contains only integers, and your
choose function will have all the choices for the possible integers, then you
can do this. Remember that columns in combo-boxes are zero-based, so
..Column(0) is the first column, and .Column(3) is the fourth column of the
selected record (assuming multi-selections is not allowed).

If you have problems, post your code so we can help.
 
I

iccsi

icssi -

If the fourth column of your drop-down contains only integers, and your
choose function will have all the choices for the possible integers, thenyou
can do this.  Remember that columns in combo-boxes are zero-based, so
.Column(0) is the first column, and .Column(3) is the fourth column of the
selected record (assuming multi-selections is not allowed).

If you have problems, post your code so we can help.

--
Daryl S



iccsi said:
I would like to use choose function from dropdown box column 4.
for example:
Choose([myform[![mydropdown]![column](4), myvalue = "something",
myvalue = "that thing")
Can I do above using choose function?
If I can, can you please advise the proper syntax?
If not, any other solution for this?
Your help is great appreciated,
.- Hide quoted text -

- Show quoted text -

I use choose function in a query. The syntax failed when I tried to
run the query like following:

Choose([Forms]![MyForm]![MyDropDown]![Column](3),
[tblMyTable].[MyID] In (Select MyID from tblMyTable where GP1 = True),
[tblMyTable].[MyID] In (Select MyID from tblMyTable where GP2 = True))


thanks again,
 
T

Tom van Stiphout

Rather than your attempt at a subselect you can use DLookup function.

I also have a feeling there should be a simpler solution with joins,
but it would require more information about your database structure to
determine that for sure.

-Tom.
Microsoft Access MVP


icssi -

If the fourth column of your drop-down contains only integers, and your
choose function will have all the choices for the possible integers, then you
can do this.  Remember that columns in combo-boxes are zero-based, so
.Column(0) is the first column, and .Column(3) is the fourth column of the
selected record (assuming multi-selections is not allowed).

If you have problems, post your code so we can help.

--
Daryl S



iccsi said:
I would like to use choose function from dropdown box column 4.
for example:
Choose([myform[![mydropdown]![column](4), myvalue = "something",
myvalue = "that thing")
Can I do above using choose function?
If I can, can you please advise the proper syntax?
If not, any other solution for this?
Your help is great appreciated,
.- Hide quoted text -

- Show quoted text -

I use choose function in a query. The syntax failed when I tried to
run the query like following:

Choose([Forms]![MyForm]![MyDropDown]![Column](3),
[tblMyTable].[MyID] In (Select MyID from tblMyTable where GP1 = True),
[tblMyTable].[MyID] In (Select MyID from tblMyTable where GP2 = True))


thanks again,
 
D

Daryl S

Iccsi -

What you posted is not a SQL statement (maybe you only posted part of it?).
The Choose function expects a list of values or expressions separated by
commas following the initial expression, but you don't have that. Something
like this would work:

Choose([Forms]![MyForm]![MyDropDown]![Column](3),"ResponseForChoice1","ResponseForchoice2","ResponseForchoice3")
But for that to work, your combo box would only have values 1, 2, or 3.

Maybe you need to explain what is in the combo box and what you want
returned based on what the user selects. For example, if you really want the
MyID from the table based on the user selecting "GP1", or "GP2", etc. from
the combo list, then what you would want is something like this:

DLookup("[MyID]","[tblMyTable]","True = [tblMyTable].[" &
[Forms]![MyForm]![MyDropDown]![Column](3) & "]")

If this isn't what you want, then let us know what your goal is...


--
Daryl S


iccsi said:
icssi -

If the fourth column of your drop-down contains only integers, and your
choose function will have all the choices for the possible integers, then you
can do this. Remember that columns in combo-boxes are zero-based, so
.Column(0) is the first column, and .Column(3) is the fourth column of the
selected record (assuming multi-selections is not allowed).

If you have problems, post your code so we can help.

--
Daryl S



iccsi said:
I would like to use choose function from dropdown box column 4.
for example:
Choose([myform[![mydropdown]![column](4), myvalue = "something",
myvalue = "that thing")
Can I do above using choose function?
If I can, can you please advise the proper syntax?
If not, any other solution for this?
Your help is great appreciated,
.- Hide quoted text -

- Show quoted text -

I use choose function in a query. The syntax failed when I tried to
run the query like following:

Choose([Forms]![MyForm]![MyDropDown]![Column](3),
[tblMyTable].[MyID] In (Select MyID from tblMyTable where GP1 = True),
[tblMyTable].[MyID] In (Select MyID from tblMyTable where GP2 = True))


thanks again,
.
 

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