Solved

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

Posted on 2004-04-04
21
178 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create a duplicate finder Application 9 122
Spell Check in VB6 13 127
Sub or Function is not defined 6 43
VBA: Insert New column with specific format type 12 38
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

839 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