me.listboxname.column(0/1/2/. . . whichever)

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

tom

Someone very kindly answered one of my earlier
posts regarding opening a form from a listbox.

Where is the reference information for the following
syntax:

docmd.openform [parameters for which you are prompted one of which is
WHERE CONDITION]
'the where codition will be something like inviocenumber =
me.listboxname.column(0/1/2/. . . whichever)

particularly the .column
 
You cannot use the .Column property of a listbox (or combobox) in a query's
criterion expression. If you want to use such a property, you'll need to
create a user-defined, public function (in a regular module) and have that
function read and return the desired value.

For example:

Public Function GetColumn4() As Variant
GetColumn4 = Forms!FormName!ListBoxName.Column(4)
End Function

(Remember that .Column is a zero-based property.)

Then your query would use the function this way:

SELECT * FROM TableName
WHERE FieldName = GetColumn4();
 

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