how to compare with combobox entries (1 Viewer)

cheberdy

Member
Local time
Today, 22:44
Joined
Mar 22, 2023
Messages
77
I have for a combobox as dataset origin this 1;putaway;2;stock removal;3;stock transfer. I would like to check the entry of the combo box then however I do not know how to read the values as variables. I have already tried 3, "3", "stock transfer". But it does not work
 

CJ_London

Super Moderator
Staff member
Local time
Today, 21:44
Joined
Feb 19, 2013
Messages
16,618
Seems to me people spend a lot of their time trying to understand your questions and you rarely respond to clarify. So I will try one more time - what have you actually tried? Since
already tried 3, "3", "stock transfer". But it does not work
Makes no sense and if it does not work - what does ‘does not work’ mean?
 

cheberdy

Member
Local time
Today, 22:44
Joined
Mar 22, 2023
Messages
77
Seems to me people spend a lot of their time trying to understand your questions and you rarely respond to clarify. So I will try one more time - what have you actually tried? Since

Makes no sense and if it does not work - what does ‘does not work’ mean?
when i select in the combo box with the name process stocktransfer, i compare process.value = "3" or 3 or "stocktransfer". The error that comes is It cannot find the field 'I1' mentioned in your expression.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 15:44
Joined
Feb 28, 2001
Messages
27,192
When using list-type combo boxes (i.e. in your case, you gave it a list of number/text-value pairs), the number part will be column 0 and the text-value will be column 1. If you want to pick up the number value, it would be comboboxname.Column(0) and because of the way you defined it, you treat that value as a number. If you want to pick up the text value, it would be comboboxname.Column(1) and you have to treat it as a string.

Note that you COULD have defined it the other way so that the text comes first and the number comes second. It IS arbitrary in how you define the list. But just remember that you have to be consistent whichever way you do it.

For some reason, a LOT of indexed items in Access are addressed this way, starting from 0 rather than from 1. Therefore, if you are going to use the xxxx(nnn) syntax, be sure to look up whether the item in question uses zero-based or one-based numbering. MOST of the time, it will be zero-based.
 

Users who are viewing this thread

Top Bottom