Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture two fields with one list box

Status
Not open for further replies.

albyh

Technical User
May 10, 2003
32
GB
Can anyone tell me how i can retrieve two fields from a list box i.e. post code and email. I need to use both bits of information for a query.

Any help will be greatly appreciated.

Thanks

Alban
 
hi

use the .column() property

say your list box has three columns, name, postcode and email, in that order from the left then

lstbox.column(1) is postcode, listbox.column(2) is Email

if you want to use these as criteria in a query, you have to fiddle around a little, create (visible=false) text boxes on your form, with source = lstbox.column(1) and =lstbox.column(2) respectively, use the text boxes in your query criteria

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
How are you loading the list box? If you are using a query/table with columns for post code and e-mail you can specify the ColumnCount = 2 and set the column widths as appropriate. When you need to refer to the values you can do
Code:
txtPostCode = ComboBoxName.Column(0).Value
txtEMail = ComboBoxName.Column(1).Value
The index which tells it which column to retrieve is zero-based which means the first column has index 0 (I know, I've been caught out before).

PeteJ
(Contract Code-monkey)

It's amazing how many ways there are to skin a cat
(apologies to the veggies)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top