.Column(index as Long,[row])

  • Thread starter Thread starter tom
  • Start date Start date
T

tom

In an effort to write some visual basic code, as I was
typing away trying to get a form to open from a
list box, the visual basic program autocompleted
partially

..Column(index as Long,[row])

as soon as I typed the (

I have no idea what this means. Can anyone help me
here?
 
tom said:
In an effort to write some visual basic code, as I was
typing away trying to get a form to open from a
list box, the visual basic program autocompleted
partially

.Column(index as Long,[row])

as soon as I typed the (

I have no idea what this means. Can anyone help me
here?

If you have a ListBox with more than one column the Value property of the
ListBox will give you the value of the bound column (if MultiSelect is
disabled). To get any other column you use...

ListBoxName.Column(0)

....to get the first column and...

ListBoxName.Column(1)

....to get the second column, etc..
 
Rick Brandt said:
tom said:
In an effort to write some visual basic code, as I was
typing away trying to get a form to open from a
list box, the visual basic program autocompleted
partially

.Column(index as Long,[row])

as soon as I typed the (

I have no idea what this means. Can anyone help me
here?

If you have a ListBox with more than one column the Value property of the
ListBox will give you the value of the bound column (if MultiSelect is
disabled). To get any other column you use...

ListBoxName.Column(0)

...to get the first column and...

ListBoxName.Column(1)

...to get the second column, etc..

Thank you, is the Value property the Default Value?
 
tom said:
Thank you, is the Value property the Default Value?

Yes. I also realized that I didn't discuss the second argument. If you only
supply the column argument then you get the row that is currently selected. The
second argument allows you to get the values from other rows. For example, the
value for the third column in the second row would be retrieved with...

ListBoxName.Column(2,1)
 
If your question is:

Is the Value the default *Property* (of the ListBox)?

then the answer is yes. However, the ListBox also has the Property "Default
Value" which is a different Property.
 
tom said:
In an effort to write some visual basic code, as I was
typing away trying to get a form to open from a
list box, the visual basic program autocompleted
partially

.Column(index as Long,[row])

as soon as I typed the (

I have no idea what this means. Can anyone help me
here?
 
I guess you looked at the Properties window of the ListBox?

The Value Property does not exist in DesignView and the Properties window is
mainly used in DesignView and therefore, the Value Property is not included
in this window. It only exists in FormView, i.e. when you are running the
Form and in fact, it is the default Property. "Default" here means that if
you simply use, for example:

MyVariable = Me.ListBox

Access VBA will interpret that you mean (in most cases):

MyVariable = Me.ListBox.Value

Thus "default" here means that you don't have to explicitly use the word
"Value" to refer to the Value of the ListBox.

If you know how to use the ObjectBrowser in the IDE (i.e. the code window),
you will see that Value is a Property of the ListBox object with a blue dot
in its icon to signify that it is the default Property.

OTOH, "Default Value" means that if you use the Form to enter a new Record,
the row that corresponds to the value you set as DefaultValue will be
automatically highlighted and unless you change the selection in the bound
ListBox to another row, this value will be stored in the Table when the
Record is saved.
 

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

Back
Top