Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-04-04
21
Medium Priority
?
191 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 500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

688 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