|
-
Sep 13th, 2005, 02:56 AM
#1
Thread Starter
New Member
[RESOLVED] multi listbox getting started
Hello - I'm using VBA in Access 2000 on Win2k.
I have a link table in my project linking products to categories.
I would like to have a combobox (drop-down) with categories, and two listboxes with the products (one for unassigned to the category, one for assigned to the category). I would like to be able to select a category, and then have the two listboxes populate. I would like to be able to move items back and forth between the two listboxes, and then hit some command button to update the database table accordingly (add, or delete rows as necessary from the productcategorylink table).
I do not know how to approach this task. I have made a form in access, but it doesn't work at all.
If someone could first give me a high-level overview of how I can approach this task.
For example, I think I need to make 3 unbound form objects (the one combobox and two listboxes). I also don't really know what bound is vs. unbound?
I'm not sure how to populate them, ie, is this something you can do on the form loading? You update the listboxes on a combobox selection (click). I can write the sql.
Also, how do you get the data into the database? I've been using the access datagrids and other forms which require no update or insert statements, because they are linked to the tables. Here is my thought: a command button which calls a script that grabs the value of the combobox and iterates through the not assigned list to delete any rows of the combobox-unassigned combinations, and then also iterates through the combobox-assigned combinations to insert rows where necessary.
I need some high-level guidance now... if my approach sounds okay, what is the way to access these objects and the methods for adding / removing, selecting and deselecting them?
Thanks in advance.
Last edited by tennisadam; Sep 13th, 2005 at 05:49 PM.
Reason: RESOLVED
-
Sep 13th, 2005, 03:01 AM
#2
Re: multi listbox getting started
are you doing this in access or vb?
-
Sep 13th, 2005, 03:21 AM
#3
Thread Starter
New Member
Re: multi listbox getting started
I am doing this in Access -- using VBA - I think it is like VB6. I can create a form in design view, and then click to go to the Microsoft Visual Basic editor.
-
Sep 13th, 2005, 03:28 AM
#4
Re: multi listbox getting started
No, VBA and VB are very different. This thread will be moved to the OFFICE DEVELOPMENT forum shortly. You can find a link to it the next time you look for it.
-
Sep 13th, 2005, 05:32 AM
#5
Re: multi listbox getting started
-
Sep 13th, 2005, 10:07 AM
#6
Thread Starter
New Member
Re: multi listbox getting started
Thanks for moving it. That might explain why some of the things I was trying that I found in the classicVB forum were not working. Any suggestions would help.
-
Sep 13th, 2005, 10:37 AM
#7
Re: multi listbox getting started
Is the product to category relationship many-to-many or many-to-one?
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Sep 13th, 2005, 11:01 AM
#8
Thread Starter
New Member
Re: multi listbox getting started
The database relationship is many-to-many.
A product can belong to many categories. And, a category can have many products.
-
Sep 13th, 2005, 11:17 AM
#9
Re: multi listbox getting started
 Originally Posted by tennisadam
I would like to be able to select a category, and then have the two listboxes populate.
Use the CHANGE Event of the Combo to call the REQUERY Method of the two lisboxes - passing the VALUE of the Combo to the SQL as a condition in the WHERE clause.
 Originally Posted by tennisadam
I would like to be able to move items back and forth between the two listboxes, and then hit some command button to update the database table accordingly (add, or delete rows as necessary from the productcategorylink table).
Use the CLICK event of the listboxes to either INSERT to or DELETE from the productcategorylink table and then call the REQUERY Method of the two lisboxes, (to refresh the 2 lists).
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Sep 13th, 2005, 05:46 PM
#10
Thread Starter
New Member
[Resolved]: multi listbox getting started
problem has been resolved. project is completed! Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|