Target List box item

  • Thread starter Thread starter Lez
  • Start date Start date
L

Lez

Hi Guys,

Looking for help targeting a selected item in a list box i have tried:

[Forms]![frmReports]![LstCust].[custID]
[Forms]![frmReports]![LstCust]!column(0)

Neither of which work, I assume am I just writing this bit wrong, help would
be appreciated.

Also, if the user was to select a number of custID from the list using multi
select, How would I get this to work?

TIA
Lez
 
Thanks for that Duane,

Is the numbering for a bound form same as it targeting by coloumn i.e. 0, 1,
2 etc

or is a bouund form 1,2,3 etc

I have tried with it bound to column 1 the custID field and still it does
not work?

anything else that might create a problem

Thanks
Lez

Duane Hookom said:
Assuming the bound column of the list box is the one you want to "target",
use:
[Forms]![frmReports]![LstCust]
Using a multi-select list box for a criteria or whatever generally means
you must write code. There is a generic function for this with sample
usage at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.


--
Duane Hookom
MS Access MVP


Lez said:
Hi Guys,

Looking for help targeting a selected item in a list box i have tried:

[Forms]![frmReports]![LstCust].[custID]
[Forms]![frmReports]![LstCust]!column(0)

Neither of which work, I assume am I just writing this bit wrong, help
would be appreciated.

Also, if the user was to select a number of custID from the list using
multi select, How would I get this to work?

TIA
Lez
 
You would not need to provide any column if the list box is single select
and the field you want to use as the criteria is the bound column. Numbering
on the form begins with 1 while code would begin with 0 being the first
column. If you want to reference a non-bound column from the list box (or
combo box), add a text box on your form and set its control source to
=LstCust.Column(x)
You can then use this text box in your query.

--
Duane Hookom
MS Access MVP

Lez said:
Thanks for that Duane,

Is the numbering for a bound form same as it targeting by coloumn i.e. 0,
1, 2 etc

or is a bouund form 1,2,3 etc

I have tried with it bound to column 1 the custID field and still it does
not work?

anything else that might create a problem

Thanks
Lez

Duane Hookom said:
Assuming the bound column of the list box is the one you want to
"target", use:
[Forms]![frmReports]![LstCust]
Using a multi-select list box for a criteria or whatever generally means
you must write code. There is a generic function for this with sample
usage at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.


--
Duane Hookom
MS Access MVP


Lez said:
Hi Guys,

Looking for help targeting a selected item in a list box i have tried:

[Forms]![frmReports]![LstCust].[custID]
[Forms]![frmReports]![LstCust]!column(0)

Neither of which work, I assume am I just writing this bit wrong, help
would be appreciated.

Also, if the user was to select a number of custID from the list using
multi select, How would I get this to work?

TIA
Lez
 
Cheers Duane,

Will try that and see what I get

Many thanks


Duane Hookom said:
You would not need to provide any column if the list box is single select
and the field you want to use as the criteria is the bound column.
Numbering on the form begins with 1 while code would begin with 0 being
the first column. If you want to reference a non-bound column from the
list box (or combo box), add a text box on your form and set its control
source to
=LstCust.Column(x)
You can then use this text box in your query.

--
Duane Hookom
MS Access MVP

Lez said:
Thanks for that Duane,

Is the numbering for a bound form same as it targeting by coloumn i.e. 0,
1, 2 etc

or is a bouund form 1,2,3 etc

I have tried with it bound to column 1 the custID field and still it does
not work?

anything else that might create a problem

Thanks
Lez

Duane Hookom said:
Assuming the bound column of the list box is the one you want to
"target", use:
[Forms]![frmReports]![LstCust]
Using a multi-select list box for a criteria or whatever generally means
you must write code. There is a generic function for this with sample
usage at
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane.


--
Duane Hookom
MS Access MVP


Hi Guys,

Looking for help targeting a selected item in a list box i have tried:

[Forms]![frmReports]![LstCust].[custID]
[Forms]![frmReports]![LstCust]!column(0)

Neither of which work, I assume am I just writing this bit wrong, help
would be appreciated.

Also, if the user was to select a number of custID from the list using
multi select, How would I get this to work?

TIA
Lez
 
Back
Top