473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

two listboxes

140 100+
hi all


i ve 2 listboxes. listbox1 has to get value from tasklist. listbox 2 has to get value from personlist.

when i select listbox1 value it should show the coressponding value. to the listbox 2

list1 has tasknames from tasklist.
list2 has to display values from personlist.

for eg( clicking(list1) office it should show (list2) employee name, etc)

help me
Nov 11 '06 #1
17 1967
NeoPa
32,556 Expert Mod 16PB
In the AfterUpdate event of listbox1 enter some code to set the listbox2.ControSource to some SQL with the WHERE clause, selecting only the data that matches the value in listbox1.
Nov 11 '06 #2
MMcCarthy
14,534 Expert Mod 8TB
In the AfterUpdate event of listbox1 enter some code to set the listbox2.ControSource to some SQL with the WHERE clause, selecting only the data that matches the value in listbox1.
Slight correction.

It's not the listbox2.ControlSource that has to be reset. This should be empty unless you want the value stored in a field.

It's the listbox2.RowSource that has to be set to a sql statement with criteria based on the selection in listbox1.

Adrian

You made a mistake. How unlike you. <grin>

Mary
Nov 12 '06 #3
indhu
140 100+
Slight correction.

It's not the listbox2.ControlSource that has to be reset. This should be empty unless you want the value stored in a field.

It's the listbox2.RowSource that has to be set to a sql statement with criteria based on the selection in listbox1.
its working but see when i click the listbox1 value only the list2 has to display the value.

under each taskid atleast person involved in it. list1 has 4taskid. when I click that taskid it should display 4 person details in list2.
Nov 13 '06 #4
MMcCarthy
14,534 Expert Mod 8TB
its working but see when i click the listbox1 value only the list2 has to display the value.

under each taskid atleast person involved in it. list1 has 4taskid. when I click that taskid it should display 4 person details in list2.
I don't really understand what you're saying. Can you post the sql statement in the Row Source property in list2 so I can see what it's doing.
Nov 13 '06 #5
indhu
140 100+
I don't really understand what you're saying. Can you post the sql statement in the Row Source property in list2 so I can see what it's doing.

listbox2.. rowsource.
SELECT person.person_id, person.Person_name, person.task, person.taskspec, person.status, person.startdate, person.endate, tasklist.task_id FROM tasklist INNER JOIN person ON tasklist.task_id=person.task_id;

list1
SELECT DISTINCT tasklist.task_id, person.person_id FROM tasklist INNER JOIN person ON tasklist.task_id=person.task_id;
Nov 14 '06 #6
MMcCarthy
14,534 Expert Mod 8TB
Change listbox2 rowsource to this:


SELECT person_id, Person_name, task, taskspec, status, startdate, endate, task_id FROM person
WHERE task_id=[Forms]![FormName]![List1];
Nov 14 '06 #7
MMcCarthy
14,534 Expert Mod 8TB
Change listbox2 rowsource to this:


SELECT person_id, Person_name, task, taskspec, status, startdate, endate, task_id FROM person
WHERE task_id=[Forms]![FormName]![List1];
You will also have to put the following in the After Update event of list1:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub list1_AfterUpdate()
  3.  
  4.   Me.list2.Requery
  5.  
  6. End Sub
  7.  
  8.  
Nov 14 '06 #8
NeoPa
32,556 Expert Mod 16PB
Slight correction.

It's not the listbox2.ControlSource that has to be reset. This should be empty unless you want the value stored in a field.

It's the listbox2.RowSource that has to be set to a sql statement with criteria based on the selection in listbox1.
Adrian

You made a mistake. How unlike you. <grin>

Mary
As usual - quite correct Mary.
You will notice that my Form work on here is not at the same level as my Query work (hopefuly).
I usually have to go and look it up in the help system (or try it out on a test form) before I give a form or control type response.
I'm learning from this myself, and also from your posts. I see form manipulation as one of your (many) strength areas.
I think many (not all) of our members would benefit greatly themselves if they just looked around a little first, tried help etc.
I'm always happy to be corrected though, saves me remembering the wrong stuff.

-Adrian.
Nov 14 '06 #9
MMcCarthy
14,534 Expert Mod 8TB
As usual - quite correct Mary.
You will notice that my Form work on here is not at the same level as my Query work (hopefuly).
I usually have to go and look it up in the help system (or try it out on a test form) before I give a form or control type response.
I'm learning from this myself, and also from your posts. I see form manipulation as one of your (many) strength areas.
I think many (not all) of our members would benefit greatly themselves if they just looked around a little first, tried help etc.
I'm always happy to be corrected though, saves me remembering the wrong stuff.

-Adrian.
Most of what I know I learned through trial and error and of course looking for examples of code online. Unfortunately, you aren't always guaranteed that the code is correct so you often have to play around with it. The help files in Access and the VB Editor are good for the basic rules. I still have to check sometimes if I haven't used a function in a while.

One of my specialities is designing user friendly bespoke applications. For 'user friendly' read LOTS of functionality. My applications these days have so much code I feel like a proper programmer , HA HA.

Mary
Nov 14 '06 #10
indhu
140 100+
Most of what I know I learned through trial and error and of course looking for examples of code online. Unfortunately, you aren't always guaranteed that the code is correct so you often have to play around with it. The help files in Access and the VB Editor are good for the basic rules. I still have to check sometimes if I haven't used a function in a while.

One of my specialities is designing user friendly bespoke applications. For 'user friendly' read LOTS of functionality. My applications these days have so much code I feel like a proper programmer , HA HA.

Mary
Hi,

its not working.

Form name: object_form

list1. i ve changed now to SELECT DISTINCT tasklist.task_id FROM tasklist ORDER BY tasklist.task_id;

list2. as u said. SELECT person.person_id, person.Person_name, person.task, person.taskspec, person.status, person.startdate, person.endate, person.task_id FROM person WHERE (((person.task_id)=Forms!object_form!List0)); I ve changed the form name to object_form.

afterupdate event

me.list2.requery thatz it.

but not working. its becos of the form name or something else.

help me out
Nov 15 '06 #11
MMcCarthy
14,534 Expert Mod 8TB
list1

SELECT DISTINCT tasklist.task_id FROM tasklist ORDER BY tasklist.task_id;

list2

SELECT person.person_id, person.Person_name, person.task, person.taskspec, person.status, person.startdate, person.endate, person.task_id FROM person WHERE (((person.task_id)=[Forms]![object_form]![List1]));

You had the wrong listbox name in list2 it should be List1 on the object_form as above.

The after update event should be on list1 but the code is

Me.List2.Requery

Yes?
Nov 15 '06 #12
indhu
140 100+
list1

SELECT DISTINCT tasklist.task_id FROM tasklist ORDER BY tasklist.task_id;

list2

SELECT person.person_id, person.Person_name, person.task, person.taskspec, person.status, person.startdate, person.endate, person.task_id FROM person WHERE (((person.task_id)=[Forms]![object_form]![List1]));

You had the wrong listbox name in list2 it should be List1 on the object_form as above.

The after update event should be on list1 but the code is

Me.List2.Requery

Yes?
still its not working. i don't know where am going wrong.


Private Sub List2_AfterUpdate()

Me.List1.Requery

End Sub

=[Forms]![object_form]![List1])); square bracket is not showing in rowsource property

is there anyother solution to execute this form.

both listboxes are in object_form

help me know
Nov 16 '06 #13
MMcCarthy
14,534 Expert Mod 8TB
still its not working. i don't know where am going wrong.


Private Sub List2_AfterUpdate()

Me.List1.Requery

End Sub
This should be

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub List1_AfterUpdate()
  3.  
  4. Me.List2.Requery
  5.  
  6. End Sub
  7.  
  8.  
Then go to the properties of List1 and make sure that [Event Procedure] appears in the After Update property on the event tab.
Nov 16 '06 #14
indhu
140 100+
This should be

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub List1_AfterUpdate()
  3.  
  4. Me.List2.Requery
  5.  
  6. End Sub
  7.  
  8.  
Then go to the properties of List1 and make sure that [Event Procedure] appears in the After Update property on the event tab.

hi

i ve tried that, its still not working
:(
Nov 16 '06 #15
indhu
140 100+
This should be

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub List1_AfterUpdate()
  3.  
  4. Me.List2.Requery
  5.  
  6. End Sub
  7.  
  8.  
Then go to the properties of List1 and make sure that [Event Procedure] appears in the After Update property on the event tab.
hi mary

its not at all working. help me out in this.
pls
Nov 16 '06 #16
indhu
140 100+
This should be

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub List1_AfterUpdate()
  3.  
  4. Me.List2.Requery
  5.  
  6. End Sub
  7.  
  8.  
Then go to the properties of List1 and make sure that [Event Procedure] appears in the After Update property on the event tab.
now i ve created new form and tried. its working pucca. thanks a lot for ur effort mary. really my head was spinning like anything today, thought of breaking this at last.
Nov 16 '06 #17
MMcCarthy
14,534 Expert Mod 8TB
now i ve created new form and tried. its working pucca. thanks a lot for ur effort mary. really my head was spinning like anything today, thought of breaking this at last.
I'm glad everythings worked out.

It was a good idea to start from scratch with a new form as sometimes you've made changes you can't remember to properties and if you don't know what you're looking for it can be a bit of a minefield.

I must admit I couldn't understand why it wasn't working.

Good work and good initiative. Just what we like in posters.

Mary
Nov 16 '06 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jeffrey Barish | last post by:
I have an application that produces two listboxes. I would like to be able to select one of the items in the first listbox and one of the items in the second listbox. However, when I make my...
3
by: softengine | last post by:
Can and how do you alter a data view to include a look up field from another data table? The data table of the dataview only has the key, the value I need is in another data table. Can and how...
3
by: Simon Templar | last post by:
I need the following functionality: With 2 listboxes populated from a database with the SAME data, I need any of the listboxes to stop displaying the option when selected at the other listbox. Eg:...
9
by: Susan Bricker | last post by:
Hi. I have two questions ... (1) I want to use a Listbox to enable the user to select 1 or many items from the list. However, I'm having trouble figuring out how to find out t which items have...
4
by: bill yeager | last post by:
I have several template columns inside of a datagrid. Inside of these template columns are databound listboxes: <asp:TemplateColumn HeaderText="Crew Chiefs"> <ItemTemplate> <asp:listbox...
0
by: Terry D | last post by:
I'm having an issue with an ASP.NET page (VS.NET 2003, VB.NET, Oracle back end). The page uses the standard VS.NET grid to display the records from a particular table. The user can edit certain...
1
by: Ryan Ternier | last post by:
I have two listboxes, and allow users to move items between them via the following function: function SwitchList(fbox, tbox){ var arrFbox = new Array(); var arrTbox = new Array(); var...
0
by: Luis Esteban Valencia | last post by:
have a problem and I'm not sure how to handle/fix it. I have three listboxes on my page. The first listbox has a list of software products. When you select an item in the Products listbox, then...
2
by: salad | last post by:
This is a tip on how to speed up listboxes DRAMATICALLY. Persons that would benefit are those that are constantly updating the rowsource of a listbox/combobox in order to filter and sort the data...
0
by: amidala | last post by:
Hello, everyone, i've recently started using C# and i'm rather new to this language. I'm trying to make a small project now that is combining the basic knowledge of programming (according to me :) )....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.