Solved

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

Posted on 2004-04-04
21
173 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
  • 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
 
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
 
LVL 7

Expert Comment

by:ramesh12
ID: 10757268
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now