<Any> item in cbx not displayed after click

  • Thread starter Thread starter Gary Schuldt
  • Start date Start date
G

Gary Schuldt

I am using the standard technique for putting an <Any> / <All> selection on
a combo box whose record source is primarily a table of selections.

My problem is that, once the <Any> selection is clicked, the combo box goes
blank instead of displaying "<Any>". Is this expected? Can I fix it? All
the rest of the code works fine.

Here's the code:

cbx Record Source:
SELECT [tForm].[FormID], [tForm].[FormName], [tForm].[PluralFormName]
FROM tForm
UNION
SELECT "", "<Any>", "Plants" FROM tForm
ORDER BY [tForm].[FormName];

Thanks.

Gary
 
The text box always shows the value in Column 1 of the
selected item from the dropdown list. In your case, that
is "" when <Any> is selected.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I am using the standard technique for putting an <Any> /
a combo box whose record source is primarily a table of selections.

My problem is that, once the <Any> selection is clicked, the combo box goes
blank instead of displaying "<Any>". Is this expected? Can I fix it? All
the rest of the code works fine.

Here's the code:

cbx Record Source:
SELECT [tForm].[FormID], [tForm].[FormName], [tForm].[PluralFormName]
FROM tForm
UNION
SELECT "", "<Any>", "Plants" FROM tForm
ORDER BY [tForm].[FormName];

Thanks.

Gary



.
 
I knew I shouldn't have posted that message so late, since I left out some
of the code:

Column Count : 2
Column Widths: 0;1.2;
Bound Column: 1

As you can see from the SELECT, the database data in this record source is
stuff like

1 name1 pname1
2 name2 pname2
3 name3 pname3
. . . .

When I click on the dropdown, I get a list of the name1, name2, name3 etc.
headed by the item <Any>.

When I then select, say name2, the cbox collapses and shows name2. But
if I select <Any>, the cbox collapses with "nothing" displayed.

Since the UNION dynaset should look like:

"" <Any> ""
1 name1 pname1
2 name2 pname2
3 name3 pname3
. . . .
why does it display col 2 in all cases but when the first row is selected,
when it displays (apparently) col 1?

It's not just this one example. I use the technique in several places, and
the same happens.

Gary

Gerald Stanley said:
The text box always shows the value in Column 1 of the
selected item from the dropdown list. In your case, that
is "" when <Any> is selected.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I am using the standard technique for putting an <Any> /
a combo box whose record source is primarily a table of selections.

My problem is that, once the <Any> selection is clicked, the combo box goes
blank instead of displaying "<Any>". Is this expected? Can I fix it? All
the rest of the code works fine.

Here's the code:

cbx Record Source:
SELECT [tForm].[FormID], [tForm].[FormName], [tForm].[PluralFormName]
FROM tForm
UNION
SELECT "", "<Any>", "Plants" FROM tForm
ORDER BY [tForm].[FormName];

Thanks.

Gary



.
 
Gary

Thanks for the extra info. My previous message needs to be
reworded to say that the ComboBox text is taken from the
first visible column.

However, your problem appears to be because the bound
column on the <Any> row is a NULL. I done some coding in
the AfterUpdate event handler and saw that <All> was
appearing in the text box but as soon as the event handler
finished, it was removed. Also, the ListIndex property
changed from 0 to -1 as if to indicate that nothing had
been selected.

My advice to you would be to change the select statement to
put " " as the first column in the <Any> row and
(hopefully) all will be well.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I knew I shouldn't have posted that message so late, since I left out some
of the code:

Column Count : 2
Column Widths: 0;1.2;
Bound Column: 1

As you can see from the SELECT, the database data in this record source is
stuff like

1 name1 pname1
2 name2 pname2
3 name3 pname3
. . . .

When I click on the dropdown, I get a list of the name1, name2, name3 etc.
headed by the item <Any>.

When I then select, say name2, the cbox collapses and shows name2. But
if I select <Any>, the cbox collapses with "nothing" displayed.

Since the UNION dynaset should look like:

"" <Any> ""
1 name1 pname1
2 name2 pname2
3 name3 pname3
. . . .
why does it display col 2 in all cases but when the first row is selected,
when it displays (apparently) col 1?

It's not just this one example. I use the technique in several places, and
the same happens.

Gary

Gerald Stanley said:
The text box always shows the value in Column 1 of the
selected item from the dropdown list. In your case, that
is "" when <Any> is selected.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I am using the standard technique for putting an <Any> /
a combo box whose record source is primarily a table of selections.

My problem is that, once the <Any> selection is clicked, the combo box goes
blank instead of displaying "<Any>". Is this expected? Can I fix it? All
the rest of the code works fine.

Here's the code:

cbx Record Source:
SELECT [tForm].[FormID], [tForm].[FormName], [tForm].[PluralFormName]
FROM tForm
UNION
SELECT "", "<Any>", "Plants" FROM tForm
ORDER BY [tForm].[FormName];

Thanks.

Gary



.


.
 
Gerald,

yes, you isolated the problem: When I put anything but an empty string (not
exactly a Null, right?), the <Any> is displayed.

But that in turn fouls up my query selection criteria. Originally, the Null
being returned to the cbx for "<Any>" was exactly the same condition when
the user doesn't select anything at all (doesn't use the cbx), which is
exactly what I wanted! The query selection criteria read Like Nz(cbx, "*"),
so when cbx was null, I got all the values for that field.

It looks now like I will have to put extra coding in for EVERY cbx where I
had used that technique to handle the case of an entry other than "" for the
first column of the "<Any>" selection.

Growl.

Thanks.

Gary
Gerald Stanley said:
Gary

Thanks for the extra info. My previous message needs to be
reworded to say that the ComboBox text is taken from the
first visible column.

However, your problem appears to be because the bound
column on the <Any> row is a NULL. I done some coding in
the AfterUpdate event handler and saw that <All> was
appearing in the text box but as soon as the event handler
finished, it was removed. Also, the ListIndex property
changed from 0 to -1 as if to indicate that nothing had
been selected.

My advice to you would be to change the select statement to
put " " as the first column in the <Any> row and
(hopefully) all will be well.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I knew I shouldn't have posted that message so late, since I left out some
of the code:

Column Count : 2
Column Widths: 0;1.2;
Bound Column: 1

As you can see from the SELECT, the database data in this record source is
stuff like

1 name1 pname1
2 name2 pname2
3 name3 pname3
. . . .

When I click on the dropdown, I get a list of the name1, name2, name3 etc.
headed by the item <Any>.

When I then select, say name2, the cbox collapses and shows name2. But
if I select <Any>, the cbox collapses with "nothing" displayed.

Since the UNION dynaset should look like:

"" <Any> ""
1 name1 pname1
2 name2 pname2
3 name3 pname3
. . . .
why does it display col 2 in all cases but when the first row is selected,
when it displays (apparently) col 1?

It's not just this one example. I use the technique in several places, and
the same happens.

Gary

Gerald Stanley said:
The text box always shows the value in Column 1 of the
selected item from the dropdown list. In your case, that
is "" when <Any> is selected.

Hope That Helps
Gerald Stanley MCSD
-----Original Message-----
I am using the standard technique for putting an <Any> /
<All> selection on
a combo box whose record source is primarily a table of
selections.

My problem is that, once the <Any> selection is clicked,
the combo box goes
blank instead of displaying "<Any>". Is this expected?
Can I fix it? All
the rest of the code works fine.

Here's the code:

cbx Record Source:
SELECT [tForm].[FormID], [tForm].[FormName],
[tForm].[PluralFormName]
FROM tForm
UNION
SELECT "", "<Any>", "Plants" FROM tForm
ORDER BY [tForm].[FormName];

Thanks.

Gary



.


.
 
Back
Top