Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

What is the best way to store selected items for later processing

Posted on 2003-02-25
14
Medium Priority
?
148 Views
Last Modified: 2010-05-01
Hi:
First let me explain how will I award points. I do not want any code but just the concept. I will award the points to that expert whos reasons convinse me. It may me wrong for others. I will look at 3-5 different ways of doing it.

Here is what I want to do.
I start my applicaton and a combo box is filled with item list from item table from MSAccess database.

I let user select the items from the combo box may be upto ten items.

I want to produce a Invoice/receipt which will list those items with the prices and once sale is completed i will update the respective tables.

Questions starts here?
What concept do I use to store the selected items? and do the rest of the processing?

Thanks.
0
Comment
Question by:dhamijap
  • 6
  • 3
  • 2
  • +3
14 Comments
 

Expert Comment

by:exjrain
ID: 8020297
I think it depends on where the program will be residing. If it's local to your network then you may not need anything more than a sequential file or a random access file. If you are looking at something on a larger scale like a WAN, I'd recommend using a table in your access database.

You can use the ADODB reference and SQL statements to create a temporary table. For the name of the table just concatinate "temp" with a random number. You can use the randomnumber generator in VB to make a random number, say between 1 and 1 million. You'll want to store the name of that temp table so that when you're all done with that customer, you can go back and delete that temp table. The reason you'll want the random number generator for the name of the temp table is incase you have a whole bunch of people using this program at the same time.

I guess it really depends on where your program is being stored, how many people will be using it, what kind of security you need, etc
0
 

Author Comment

by:dhamijap
ID: 8020441
MORE INFO ABOUT MY QUESTION:
It is small application which will run on a stand alone desktop. Only one person will use.

0
 

Author Comment

by:dhamijap
ID: 8020463
exjrain:
So r u saying that i should create a temporary table in the memory? and process it any way I need. Please tell me why it is best over array?
Thanks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:Da_Weasel
ID: 8021116
so you want the user to be able to select from list of items in a combobox that populates itself with data from a Access table.  When an item is selected it should be added to a list.  When the person is done selecting items they will click something to purchace those items (create an invoice)?

If you are not saving the info about the items that the person selected past the creation of the invoice then you will only need one table which should hold the item info like this

Items
ID     Name     Description     Price
1      Widget   Something       1.23
2      Thingy   Something       5.43
3      Wobler   Something       3.45
4      Zinger   Something       0.98
5      Zapper   Something       7.24

Populate the combobox with the item names and have a 'Purchace' buttons next to it.
When the purchace button is clicked add the item info to a listbox below it based on the RecordSet used to populate the combobox.
Place a 'Check Out' button below the list box and when that it clicked show a Invoice form that will display the list of selected items and total.
Put 'Print' and 'Finish' buttons on the Invoice form.  When the Finish button is clicked the Invoice form should be closed and the original form should be cleared.

Hope this is what you were looking for....
0
 
LVL 1

Expert Comment

by:tgraffham
ID: 8021822
First of all, since you can't select multiple items in a combobox, I'm assuming that you either mean a listbox or as DaWeasel said, a combobox that populates a listbox.  (or is the user really going to select items one at a time from a combobox and on each selection, you populate whatever you decide to use per the whole point of this question?).

This seems to be to be WAY simpler than it must be.  If you're just giving your user a form with a list box on it and they're selecting multiple items in that listbox AND assuming you're doing the "purchase this" button on that form as well, you don't need to store the values anywhere.  They're in the listbox already.

For Each varItem in myListBox.ItemsSelected
     'Do whatever
Next

That's it.

Perhaps you'd better give a little more detail about the scope of the process and the timing of selecting items versus generating your invoice.  Then we may be able to give you more complete answers.  Otherwise, it sounds like a simple form with simple controls and little code behind it...nothing more.

Hope this helps,
Tim
0
 

Author Comment

by:dhamijap
ID: 8025195
Da_Weasel &  tgraffham:

Since it is getting more involved than i wanted it to. I am raising points to 100.

You both have somewhat close to the answer. I have a datacombo automatically filled from a Access database table. Datacombo has ItemId as BoundColumn and Description as ListField. The user will select one item at a time e.g. User will search the item in the combo and click on "ADD" button to add to invoice. Actualy, I want to display all the selected items in a seperate frame with whatever control you will suggest. This control shoul be able to let me code for select and remove items. My question is how do i do that? which contorl do I use to create a listing of selected items(possible display the same control as invoice) and create a total sale amount? Once used pays for it(by clicking CompleteSale) I will take the listing ItemID and Quantity and update the ItemTable and also update the InvoiceDetail table.  I do not need any code to do any of this. I will post another question for code questions. I will code for whatever I  know how to insert data into the InvoiceDetail table, and then clear the control. It does not have to be control I want some one who knows how to do it best.

* I have thought of keeping the items in Array or Recordset etc. But there might be something better than what i can think. Please help. I do not want this question drag for long. Thanks for reading all that.


This is how I expect the answer:
1 Use "????" controls
2 use "XXX" control to hold the data
3 use "this" control to display the invoice
4 couple lines to tell me why?
or
1 Do this way
2 couple lines to tell me why?

Of course, you can type as much as you want to make your point. I am just trying to save you guys time. It is upto you. Thanks again.
0
 
LVL 3

Expert Comment

by:Da_Weasel
ID: 8025551
Can they order more than of single item?
0
 
LVL 3

Expert Comment

by:Gunsen
ID: 8026956
listening



0
 

Author Comment

by:dhamijap
ID: 8027060
yes, as many as they want or we can limit to 10
0
 
LVL 3

Expert Comment

by:Gunsen
ID: 8027184
this is a web app yes ?
0
 

Author Comment

by:dhamijap
ID: 8027264
no stand alone on a desktop using windows XP home.
0
 
LVL 3

Accepted Solution

by:
Da_Weasel earned 400 total points
ID: 8027353
ok so this is the simplest method to get what you want.

make array STRUCT that is the same size as the number of items in the combo with the following members
ID
Name
Count

eachtime they click on add item you use the ID value to to find the same item in the array and increment its item count
then update the listbox with the contents of the array, so the list box shows selected items like this
(2) Widget
(1) Wooble
(10) Thingies

when the Check Out button is clicked you can use the Array.Count and Rs to calculate the prices
I would use a Crytstal Report control.
0
 

Author Comment

by:dhamijap
ID: 8027680
Da Weasel:

Just want to see what you are saying:
Suppose I have 50 records in the table.
Now DataCombo has 50 items

Create a Array with 50 length to store my data to do plus or minus of items sold or returned.

populate a listbox with the user selected items.

User crystal report control to produce invoice or bill\receipt.

Is crystal report control a part of VB6?
0
 

Expert Comment

by:SpideyMod
ID: 8265985
Force Accepted (http://www.experts-exchange.com/Community_Support/CleanUp/Q_20565385.html)

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

571 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