FredCailloux
Registered User.
- Local time
- Today, 11:58
- Joined
- Feb 1, 2017
- Messages
- 15
I have a ComboBox on an Access Form that is populated with a recordset comprising two columns. Column1 called lngCatIndex, a Long number and column2 called txtCategory, a corresponding text field. That ComboBox named combCategory is modified by a VBA command as such:
When executing that code the combCategory change it's value to the proper corresponding display. The user will see the text only because the combCategory properties are as such:
then the combCategory will display the corresponding Text from column two, Transistor.
If I assign
then the combCategory will display the corresponding Text from column two, Capacitor.
That assigned number or text are of radically different type. I would assume that one of the two would generate a VBA error, but no!
Furthermore, by assigning a different type to the combCategory the ComboBox will still display the corresponding Correct Value!!! despite the difference in assigned type. It's as if the ComboBox could accept any value of any column regardless of whether it is for column1 or column2 or whatever else and find a correspond value in it's recordset and accept that record as the corresponding one That is definitely Not a "normal" computer coding philosophy.
If I had a ComboBox with 25 different columns of type Integer, Long, String, Double, String, Double, Integer, Long...
How would that work ? Rather confusing if you ask me!
Can anyone offer an explanation to this peculiar flexibility ?
Code:
combCategory = MyVariable
Which means that the linked column is a number, which value is invisible and the displayed column is column2 the text representing the column1 value. example:linked column : 1
number of columns : 2
columns width : 0cm, 3cm
Here is what appear to me as a rather strange behavior of my ComboBox. If I assingLong number, String text
not visible, visible
1, Capacitor
2, Transistor
3, Inductor
etc...
Code:
combCategory = (a long number like 2 )
If I assign
Code:
combCategory = (a string text like "Capacitor")
That assigned number or text are of radically different type. I would assume that one of the two would generate a VBA error, but no!
Furthermore, by assigning a different type to the combCategory the ComboBox will still display the corresponding Correct Value!!! despite the difference in assigned type. It's as if the ComboBox could accept any value of any column regardless of whether it is for column1 or column2 or whatever else and find a correspond value in it's recordset and accept that record as the corresponding one That is definitely Not a "normal" computer coding philosophy.
If I had a ComboBox with 25 different columns of type Integer, Long, String, Double, String, Double, Integer, Long...
How would that work ? Rather confusing if you ask me!
Can anyone offer an explanation to this peculiar flexibility ?