M
Mike Samyn
To All: I am really stuck on an Access Control problem and I haven't seen
this exact problem addressed in the Access forum so here goes.
I’ve written some code in an Access 2003 form to generate dynamic SQL based
on selections for combo boxes. All works very well except for one problem.
One of the series of combo boxes allows the user to select criteria based on
either selecting values from the combo box row source or by typing them it
into the box. Also I allow the '*' character as a wild card character. This
works fine with text or numeric values the first time around. However, if
the user attempts to update a previously used combo box that has a numeric
value with a text value the combo box complains saying, “The value you
entered isn’t valid for this fieldâ€. The only way to correct the problem is
to close and restart the form.
My combo boxes are bound via queries that reference tables which are filled
based on other combo box selections of fields in the DB. Here is what one
looks like.
ComboBox_1.RowSource = “SELECT tbl_Combobox_Data1.* FROM tbl_Combobox_Data1;â€
ComboBox_1.DefaultValue = “*â€
ComboBox_1.Value = will vary – either selected from the row source or hand
entered including '*'.
As the user selects different fields to build a different SQL statement the
code change the values in the row source tables as needed and re-queries the
control. The problem comes when the user selects a value in the Combo Box.
It appears that the CB assumes the value type (numeric [integer or real] or
text) from the selection and then locks the combo box into that format until
I close the form. There MUST be a way to reset the CB programmatically.
I’ve tried to reset every possible property w/o success. Attempting to null,
or blank out, or reassign row sources w/o success. Any help would be greatly
appreciated.
this exact problem addressed in the Access forum so here goes.
I’ve written some code in an Access 2003 form to generate dynamic SQL based
on selections for combo boxes. All works very well except for one problem.
One of the series of combo boxes allows the user to select criteria based on
either selecting values from the combo box row source or by typing them it
into the box. Also I allow the '*' character as a wild card character. This
works fine with text or numeric values the first time around. However, if
the user attempts to update a previously used combo box that has a numeric
value with a text value the combo box complains saying, “The value you
entered isn’t valid for this fieldâ€. The only way to correct the problem is
to close and restart the form.
My combo boxes are bound via queries that reference tables which are filled
based on other combo box selections of fields in the DB. Here is what one
looks like.
ComboBox_1.RowSource = “SELECT tbl_Combobox_Data1.* FROM tbl_Combobox_Data1;â€
ComboBox_1.DefaultValue = “*â€
ComboBox_1.Value = will vary – either selected from the row source or hand
entered including '*'.
As the user selects different fields to build a different SQL statement the
code change the values in the row source tables as needed and re-queries the
control. The problem comes when the user selects a value in the Combo Box.
It appears that the CB assumes the value type (numeric [integer or real] or
text) from the selection and then locks the combo box into that format until
I close the form. There MUST be a way to reset the CB programmatically.
I’ve tried to reset every possible property w/o success. Attempting to null,
or blank out, or reassign row sources w/o success. Any help would be greatly
appreciated.