Hi All,
I have a Listbox control on a pop-up Form (dialog mode), which by default has it's RowSource a Select Query (RowSource Type: Table/Query). When activated the dialog pops up nicely and displays the correct data as designed.
The Form also has an contains an Option Group, with two options. Depending on which option the user chooses, the data displayed in the ListBox changes. This is managed in code via two SQL strings. This seems to work well.
Option one is the default, and the RowSource is set when the Form loads, with the following SQL string:
"SELECT BookingID, CustCompany, CustID FROM qrySearchInvoice ORDER BY BookingID"
When the user selects option two the RowSourcec is set to the following SQL string:
"SELECT CustCompany, CustID, BookingID FROM qrySearchInvoice ORDER BY CustCompany"
Choosing and switching between the two options works well and the ListBox requeries nicely and displays the correct data, correctly ordered. The ListBox is set to Bound Column 1, in the Properties Sheet, not in code. The ListBox is requeried after each SQL string is assigned to the RowSource.
When the ListBox displays option one data, and the user selects a row, all is well. However, if option two data is displayed, as soon as the user selects a row, it triggers an Error Message which says:
"The Value you entered isn't valid for the Field. You may have entered text in a numeric field, or a number that is larger than the FieldSize permits"
Whilst I understand what the Error Message means, I don't know what is causing it, or how to get rid of it. The selected Fields in the SQL have the following data types:
BookingID = Long
CustCompany = String
CustID = Long.
Bound Column is 1 in each case. The Error message is probably being triggered by CustCompany being datatype String and not a Long. But I have no idea what to do about it. Help please, anyone?
Prof.