Solved

Making all listboxes display diff. fields of the same record.

Posted on 2004-04-04
21
187 Views
Last Modified: 2011-09-20
Hi everyone at EE,

I have 3 datalist boxes. Each listbox will display a different field of the same table, each sorted alphabetically.

What I want is that when any selection is made from either of the 3 lists, the other 2 lists' corresponding record values should automatically get selected.
In this way, my adodc component is always pointing to a particular record.
0
Comment
Question by:hag1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
  • 2
21 Comments
 
LVL 18

Accepted Solution

by:
Sethi earned 125 total points
ID: 10751749
Private Sub Listbox1_Click()
  Listbox2.ListIndex=Listbox1.ListIndex
  Listbox3.ListIndex=Listbox1.ListIndex
End Sub

Private Sub Listbox2_Click()
  Listbox1.ListIndex=Listbox2.ListIndex
  Listbox3.ListIndex=Listbox2.ListIndex
End Sub

Private Sub Listbox3_Click()
  Listbox1.ListIndex=Listbox3.ListIndex
  Listbox2.ListIndex=Listbox3.ListIndex
End Sub
0
 

Author Comment

by:hag1
ID: 10751868
I am using a datalist which has no listindex property.
So instead of listindex, which property should I use?
0
 
LVL 7

Expert Comment

by:ramesh12
ID: 10752337
C this URL
http://support.microsoft.com/?kbid=189682
and this
http://www.devx.com/vb2themax/Tip/18430
It seems there is a boundcolumn property. Just check these urls
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:Sethi
ID: 10752733
Check the SelectedIndex property
0
 

Author Comment

by:hag1
ID: 10756221
I couldnt find any selected index property.

Anyway if you think the code in the first comment by sethi for a listbox will perform what I need, then I dont mind going for a listbox.

To connect a listbox, I tried:
datasource=adodc
datafield=column name
But, I couldnt even get the listbox to display the values.
Am I suppose to set any other property of the listbox to make it display the data?
0
 

Author Comment

by:hag1
ID: 10756243
Could anyone explain a bit in detail as to what the bound column property mean?
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10756631
That was a Typing mistake...it is selecteditem property. Sorry for all the confusion.
0
 

Author Comment

by:hag1
ID: 10758812
Sethi,

I used the selecteditem property and got the following error as soon as a selection was made in the datalist.

Run-time error 424. Object required.

During debug(when I moved my mouse over the selected statement), the LHS expression displayed 1 and RHS 2
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10758913
hag1...I dont have access to VB for a few days as I am on holiday at the moment. So I am not in a position to test this at my end. Did you try the solution provided by ramesh12
0
 

Author Comment

by:hag1
ID: 10759026
I have viewed all the links provided by ramesh12 and I am not sure as to how exactly to use them in my case.
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10759059
OK...I will go though them and tell youu in a few minutes.
0
 

Author Comment

by:hag1
ID: 10759070
ok, if I change to listbox, then what other properties apart from recordsource and datafield do I need to set?
0
 

Author Comment

by:hag1
ID: 10759091
Thanks Sethi for going through them inspite of being on a vacation.
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10759223
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10759232
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10759240
OK, sleep time here. See ya tmr. Hope things will work out well for you
0
 

Author Comment

by:hag1
ID: 10783688
hi,
 you may take your own time to answer this question. I too was busy & couldnt reply, sorry for that.
Instead of the datalists, I simply used a databound grid.

But anyway, I would like to know how can I use datalists the way I imagined?
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10783809
hag1, I wont be a great help on that becuase I dont use bound control at all.
0
 

Author Comment

by:hag1
ID: 10783960
Anyway, my aim in using 3 such lists was to make the program as user-friendly as possible. The user could have selected a particular recordset using any field he/she knew.


I think I will close the thread.

A big thanks.

hag1
0
 
LVL 18

Expert Comment

by:Sethi
ID: 10784871
Thanks for the points
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month5 days, 4 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question