Store non-bound combo column as combo's control source?

  • Thread starter Thread starter Nick Mirro
  • Start date Start date
N

Nick Mirro

Any idea how to get a combo with 3 columns to store a non-bound column as
its control source? I need to access this field for a report.

If I change the combo's bound column, a vb afterupdate procedure loses
access to the needed bound column.

Nick


Combo columns

CPTID (hidden bound column)
CPTCode (need to store for report)
CPTDescription


In table which is combo's control source, I'm only storing CPTID's, which I
don't need. I'd rather store CPTCode.
 
You can reference the value of the second column (CPTCode)
by using the Column property of the combobox as follows:
Forms![YourFormName]![ComboboxName].Column(1)
 
Thank you for your help with this.

Just to clarify, this reference is for use in the vb procedure? I didn't
see a "column" property for the combo. Did you mean the "control source"
property?

Nick



Jack said:
You can reference the value of the second column (CPTCode)
by using the Column property of the combobox as follows:
Forms![YourFormName]![ComboboxName].Column(1)
-----Original Message-----
Any idea how to get a combo with 3 columns to store a non- bound column as
its control source? I need to access this field for a report.

If I change the combo's bound column, a vb afterupdate procedure loses
access to the needed bound column.

Nick


Combo columns

CPTID (hidden bound column)
CPTCode (need to store for report)
CPTDescription


In table which is combo's control source, I'm only storing CPTID's, which I
don't need. I'd rather store CPTCode.


.
 
Yes, there is a Column Property for Access ComboBox which you can use in
VBA.

--
HTH
Van T. Dinh
MVP (Access)



Nick Mirro said:
Thank you for your help with this.

Just to clarify, this reference is for use in the vb procedure? I didn't
see a "column" property for the combo. Did you mean the "control source"
property?

Nick



Jack said:
You can reference the value of the second column (CPTCode)
by using the Column property of the combobox as follows:
Forms![YourFormName]![ComboboxName].Column(1)
-----Original Message-----
Any idea how to get a combo with 3 columns to store a non- bound column as
its control source? I need to access this field for a report.

If I change the combo's bound column, a vb afterupdate procedure loses
access to the needed bound column.

Nick


Combo columns

CPTID (hidden bound column)
CPTCode (need to store for report)
CPTDescription


In table which is combo's control source, I'm only storing CPTID's, which I
don't need. I'd rather store CPTCode.


.
 
It is not the "Control Source" property. It must be
referenced with vb code.
-----Original Message-----
Thank you for your help with this.

Just to clarify, this reference is for use in the vb procedure? I didn't
see a "column" property for the combo. Did you mean the "control source"
property?

Nick



Jack said:
You can reference the value of the second column (CPTCode)
by using the Column property of the combobox as follows:
Forms![YourFormName]![ComboboxName].Column(1)
-----Original Message-----
Any idea how to get a combo with 3 columns to store a
non-
bound column as
its control source? I need to access this field for a report.

If I change the combo's bound column, a vb afterupdate procedure loses
access to the needed bound column.

Nick


Combo columns

CPTID (hidden bound column)
CPTCode (need to store for report)
CPTDescription


In table which is combo's control source, I'm only storing CPTID's, which I
don't need. I'd rather store CPTCode.


.


.
 
Nick,

To expand on what Nick and Van are saying, the Column property (available in
code only) will return the value of other columns in the combo besides the
one that is the first one and usually the one that is stored.

In a combobox that has three columns for example you may have 3 columns only
two of which are shown. A lot of times you would hide the ID column (which
is actually the one being stored) and just show maybe LastName and
FirstName. In this example the to reference the ID you would use Column(0)
as 0 is always the first one and the first one is usually the one that is
stored if you bind the combo to a field (confusing). LastName would be
Column(1) (the second one) and FirstName would be Column(2) ( the third
one). It is kind of like you take the column counts and subtract by one.

A full reference to the LastName would go something like this, substituting
your control names...
Me!FieldToFill = Me!cboYourComboName.Column(1)

Gary Miller


Nick Mirro said:
Thank you for your help with this.

Just to clarify, this reference is for use in the vb procedure? I didn't
see a "column" property for the combo. Did you mean the "control source"
property?

Nick



Jack said:
You can reference the value of the second column (CPTCode)
by using the Column property of the combobox as follows:
Forms![YourFormName]![ComboboxName].Column(1)
-----Original Message-----
Any idea how to get a combo with 3 columns to store a non- bound column as
its control source? I need to access this field for a report.

If I change the combo's bound column, a vb afterupdate procedure loses
access to the needed bound column.

Nick


Combo columns

CPTID (hidden bound column)
CPTCode (need to store for report)
CPTDescription


In table which is combo's control source, I'm only storing CPTID's, which I
don't need. I'd rather store CPTCode.


.
 
Back
Top