How to get the value of non-bound combo box column?

L

LAS

I thought the following was the correct syntax, and it compiles OK, but when
there's good data in the dropdown and in the combo box, this is null.
cboInfluence.Column(2)

My combo box has 2 columns. The first has 0" width, but is the bound
column. The second is what shows in the dropdown, and the values look good.

What am I missing?

TIA
LAS
 
B

Bob Quintal

I thought the following was the correct syntax, and it compiles
OK, but when there's good data in the dropdown and in the combo
box, this is null. cboInfluence.Column(2)

My combo box has 2 columns. The first has 0" width, but is the
bound column. The second is what shows in the dropdown, and the
values look good.

What am I missing?

TIA
LAS
A good book on Accsess is what you are missing.

The Column() property is a Zero-Based array. your Column(2) therefore
refers to the third column in the combobox. Since you claim to only
have two columns, you are getting Nulls.
 
L

LAS

See below.

Bob Quintal said:
A good book on Accsess is what you are missing.

It's usually not productive to get into this sort of thing, but you are the
second person to suggest that I get an Access book instead of posting
questions in this newsgroup. Access is not my main programming language,
but several years ago I developed a fairly sophisticated application with
lots of input forms, reports, graphs, menus, etc. I have several Access
books, which I read at that time. Then I was away from the application and
Access for about a year and a half. "I don't know the basics and should
read the books again" is not the first thing that comes to my mind. I
forgot about the zero based arrays. Thanks for reminding me.

As for the difference between recordsets and recordset variables (different
thread), that is new to me. I use recordset variables everywhere in my
applicatin, and, believe me, I didn't invent the idea. I certainly was
using examples from somewhere. Books and user group meetings. I'm still
not clear about the differences. As I said in the other thread.
Me.Recordset dot doesn't produce a list of properties. That seems like a
loss. And the recordset variable seems to work find all over the place, so
I'm still not clear about the big downside. Maybe it's only the fact that
each has distinct .NewRecord properties????
 
D

David W. Fenton

It's usually not productive to get into this sort of thing, but
you are the second person to suggest that I get an Access book
instead of posting questions in this newsgroup.

You clearly don't understand the basics of how Access is designed to
be used. You are jumping to the most complicated methods before
actually trying to do things "the Access way." That's why people are
suggesting you read some books, because you seem not to have grasped
the most elementary things about the way Access is designed to be
used by a programmer.
 
A

Access Developer

In the Control's properties, that means the second column; in code, the
column index begins with 0 -- try using Column(1) in VBA code.

I think you'd save a good deal of trouble if you'd study a couple of good
books -- say "Microsoft Access Step by Step" and "Microsoft Access Inside
Out" for the version of Access you are using.
 
B

Bob Quintal

See below.



It's usually not productive to get into this sort of thing, but
you are the second person to suggest that I get an Access book
instead of posting questions in this newsgroup. Access is not my
main programming language, but several years ago I developed a
fairly sophisticated application with lots of input forms,
reports, graphs, menus, etc. I have several Access books, which I
read at that time. Then I was away from the application and
Access for about a year and a half. "I don't know the basics and
should read the books again" is not the first thing that comes to
my mind. I forgot about the zero based arrays. Thanks for
reminding me.

I hope you were not too offended, The things you had trouble with are
very basic. I reiterated Larry's comment about a book in part because
those are the problems that bite everyone when they start to use
Access VBA, and are covered in every Access textbook I've read.

From the problems you reported, and the language you used to describe
them, I think everybody thought that you were one of this year's
high-school graduates, helping in dad's office before heading off to
college.

Access and VBA aren't my main languages either, and I've learned from
experience that when switching from one programming environment to
another I need to stop and reacquaint myself with the one before me.
I recently had to update an application I last touched in 1999, and
I'd certainly code it differently if I were starting it from scratch
today.
As for the difference between recordsets and recordset variables
(different thread), that is new to me. I use recordset variables
everywhere in my applicatin, and, believe me, I didn't invent the
idea. I certainly was using examples from somewhere. Books and
user group meetings. I'm still not clear about the differences.
As I said in the other thread. Me.Recordset dot doesn't produce a
list of properties. That seems like a loss. And the recordset
variable seems to work find all over the place, so I'm still not
clear about the big downside. Maybe it's only the fact that each
has distinct .NewRecord properties????

I use recordsets very often as well, but it is also basic knowledge
that any access form or report uses a recordset to walk through the
rows returned from the record source. One simply needs to remember
that any recordset you create is going to be different and have its
own set of properties and one must be careful not to issue
instructions to the wrong recordset if you have several open.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top