G
This is something I've done plenty of times in '97, but I can't seem to
get it to work correctly in Access 2003. Say, for example, I have a
form with an unbound combobox, the data source is a table of customers,
first column is the key field, which is hidden with a 0" width, and the
second column is the customer name. The SQL is a union query that also
inserts Null in the first column, and "All" in the second column. That
combobox gets used as criteria for a query, such that a value entered
by the user restricts the results to records that are related to that
customer, and choosing "All" results in that combobox having a null
value, which I use in the query to return records irrespective of the
customer.
Functionally, it works fine in 2003 as it did in '97: "All" shows up
in the combobox as a possible selection, and when it's selected, the
comboboxes value gets set to Null, which I use in the query to not have
the customer ID be a criteria in the results. The problem is in the
display: in '97, I could set the default value of that combobox to
Null, and the format of that field to @;"All", which would
automatically display "All" in that field when the form was opened,
showing that as a default, all customers would be returned. In 2003,
the combobox is blank. The value of the combobox is null, as it should
be, but the word "All" doesn't show up in that field until the user
pulls it down and selects All. I even have other controls that
programatically reset this combobox to Null, and in that case, it also
doesn't work: it is simply a blank display.
In short, the combobox will not display "All" on a null value UNLESS
that value was selected by the user. How do I get the combobox to
display a pre-defined string when the value of that control is Null,
even when the value wasn't set to Null directly by the user by
selection within the combobox?
Thanks!
get it to work correctly in Access 2003. Say, for example, I have a
form with an unbound combobox, the data source is a table of customers,
first column is the key field, which is hidden with a 0" width, and the
second column is the customer name. The SQL is a union query that also
inserts Null in the first column, and "All" in the second column. That
combobox gets used as criteria for a query, such that a value entered
by the user restricts the results to records that are related to that
customer, and choosing "All" results in that combobox having a null
value, which I use in the query to return records irrespective of the
customer.
Functionally, it works fine in 2003 as it did in '97: "All" shows up
in the combobox as a possible selection, and when it's selected, the
comboboxes value gets set to Null, which I use in the query to not have
the customer ID be a criteria in the results. The problem is in the
display: in '97, I could set the default value of that combobox to
Null, and the format of that field to @;"All", which would
automatically display "All" in that field when the form was opened,
showing that as a default, all customers would be returned. In 2003,
the combobox is blank. The value of the combobox is null, as it should
be, but the word "All" doesn't show up in that field until the user
pulls it down and selects All. I even have other controls that
programatically reset this combobox to Null, and in that case, it also
doesn't work: it is simply a blank display.
In short, the combobox will not display "All" on a null value UNLESS
that value was selected by the user. How do I get the combobox to
display a pre-defined string when the value of that control is Null,
even when the value wasn't set to Null directly by the user by
selection within the combobox?
Thanks!