Access 2003 Windows XP
I have a combo box on a my form fOptions named cboSortOrder
Relevant properties are:
Name: cboSortOrder
Row Source Type: = Value List
Row Source : "";"Ascending", "ORDER BY DESC","Descendi ng"
Bound Column : 1
Column Count: 2
Column Widths: 0";2"
I intended to write code such as:
If I choose 'Descending' in my combo box, then the combo box displays 'Descending' and in the Immediate Pane ?Forms!fOptions .cboSortOrder is: ORDER BY DESC
But if I choose 'Ascending', then the combo box displays a blank/empty and ?Forms!fOptions .cboSortOrder is: Null
Why is this result Null? It is clearly set to a zero-length string in Row Source and a zero-length string is not Null.
Why doesn't the word 'Ascending' appear in the combo box when selected?
I am NOT looking for a fix, but for understanding. I can work around this. In the above example, replacing "" with " " in Row Source makes everything work as expected, with the current Jet Engine. Other places not so simple, but I can use numeric values in column 1 (Bound) and If ... then ... else statements to build my SQL Statements.
I was trying to simplify my code, but I don't like to rely on other programs (Jet) to work correctly in the future with non-perfect data.
I have a combo box on a my form fOptions named cboSortOrder
Relevant properties are:
Name: cboSortOrder
Row Source Type: = Value List
Row Source : "";"Ascending", "ORDER BY DESC","Descendi ng"
Bound Column : 1
Column Count: 2
Column Widths: 0";2"
I intended to write code such as:
Code:
sqlShow = sqlSELECT & sqlFROM & sqlWHERE & [cboSortOrder] & ";"
But if I choose 'Ascending', then the combo box displays a blank/empty and ?Forms!fOptions .cboSortOrder is: Null
Why is this result Null? It is clearly set to a zero-length string in Row Source and a zero-length string is not Null.
Why doesn't the word 'Ascending' appear in the combo box when selected?
I am NOT looking for a fix, but for understanding. I can work around this. In the above example, replacing "" with " " in Row Source makes everything work as expected, with the current Jet Engine. Other places not so simple, but I can use numeric values in column 1 (Bound) and If ... then ... else statements to build my SQL Statements.
I was trying to simplify my code, but I don't like to rely on other programs (Jet) to work correctly in the future with non-perfect data.
Comment