|
-
Mar 30th, 2008, 04:34 PM
#1
Thread Starter
New Member
ADO access database manipulation questions
I currently am making a program that prompts the user to select a database file they want to work with. After they choose one, the data is displayed in a listbox. From here they will pick and choose what they want, clicking a command button will add whatever highlighted value and place it in a new listbox.
For example, say I wanted to have program that you created a grocery shopping list from a database of every food item ever. So you choose the food from the left, and add it to your growing list on the right. I have managed to do this rather easily but I have questions regarding carrying connected values along.
Let's say my databass has 5 foods WITH color and average prices.. something like..
Food Name | Color | Food Cost |
-----------------------------------
Apple Green 1.00
Apple Red 1.50
Banana Yellow .50
Coconut Brown 2.00
Watermelon Green 5.00
Now, all that i need to display to the user is the food name. But after the user is done building their grocery list, I want to add up the cost of all the items they chose. So how can I keep the costs of each food somehow tied to the food name? Since when it gets transfered to the new listbox it's basically just a string? I want the grocery list to be fully customizable, in that you can add an item to it, then delete one from it if you make a mistake, etc. I guess my main question is how can you keep attributes to the food name such as color and price, stay tied to the food name so at the end I can take all the food names in the new list and add up the costs of each accordingly?
Or is there already a built-in fuction in access that keeps everything tied together like the ID#?
Thanks in advance.
-
Mar 31st, 2008, 11:53 AM
#2
Re: ADO access database manipulation questions
Yes, you need some type of ID so you can retrieve the information for each item. But I think a good solution would be to use the "List View" control instead of the "list box". Then the user can just mark the check box for each item they want. The cost would be available without having to look for it in the database.
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
|