(DESKTOP)Making a Temp Cart

What I’m trying to do now is for instead of writing all the items to it and then have to call it back if the user needs to remove something or change it before completing the order, I’m wanting to write all the data to a cvs file or just a hidden window with a listbox to keep the temp info. as of now it is set up that the user can only create one Unique item at a time that can have multiple sub items ( REASON: Its for Creating a t shirt design and you can pick as many shirts you will need with that design on it until you add it to cart then you can create the next shirt or pants if it has a different design. or if you want that design on a different item like Hat or Pants.) So what I’m asking is what would be an easier way of storing that info for a temp time before the user completes the order and clicks the button. After that i need it so after the user clicked the complete button that it sends all that info it was storing to the xls file. but I’m not sure how to call certain lines in the listbox that is why i was thinking a cvs file but then i don’t know how to make it still write from there to the xls. Any ideas ? Examples ? I’m a visual learner!

Thank you
Travis McBride

Anyone have any ideas?

Is there a reason you’re not using a database for this? Do you intend to keep the orders around? Or just flush them to XLS and lose track of them on disk?

If the data is non-persistant (ie. the “cart” empties if the user leaves), then use an in memory database

+1 to that. I seem to remember some of your other posts revolve around getting stuff in and out of Excel sheets - if you really want everything stored in Excel then you’d probably be better off learning VBA for Excel.

@Tim Hare , The only reason I’m not storing all of it into a database is because I’m just saving the file name in the database by using the Primary Key in my CustomerDB.Invoice database and using the invoice number as my filename. I just want to keep the info that the user has enter for a temp time until the user submits the order. Could i just kick all the info out to a new window with a listbox ? so the user can still edit the order if they need to add something different or has a mistake ? Or can i just make it so the user picks the amount of unique items (like Pants, Hoodie, Tshirt, = 3) and then it makes 3 tabs and creates all the fields needed on each tab so i don’t need a cart page? Just trying to figure a good way to do this. if anyone has an Idea please let me know. and Its not an excel program @Richard Brown , Im just using the XLS for our print out for an Invoice, Mailing List. but i was an old VB programmer but haven’t coded in years till now!. Thank you all

You are definitely using an antiquated approach. Storing the data in a database would make things easier for you AND allow you to easily answer questions such as “who have we sold item X to in the last 2 years?” and “how many of item Y have sold, vs. how many of item Z?” That information is much harder if not impossible to get from flat files.

But, yeah, you could store the data in a hidden listbox or and array of class objects or any of a number of other approaches.

As far as how to present the information to the user, here’s a screenshot of a quickie app I put together for a client to run on a tablet in the field. It uses an sqlite database for local storage and syncs with their main system when they get back to the warehouse.


There are 3 sections to the window. One to enter the customer info, one to enter a single line item, and a list of line items. Hopefully, it will give you some ideas to work off of.

@Tim Hare Your Absolutely right i should store everything. makes so much more since if i want to do a lookup of items sold. ty so much I’m going to take a look at what you made and get back to you.

Thank you
Travis McBride

@Tim Hare I Like the idea of the database grabbing the item and adding it like that but what if our items are not a set item. I work for a TShirt Printing and Embroidering Company and we don’t have set items . Like for now our Regular Tshirt is 29M. by next month it might be something different and i don’t think adding all the items to the database is a good idea because of the sudden changes. But i thought of an idea. What if i created a Listbox just as you have in your example and create a database that stores all the info from my Form and displays some info to the Listbox (Like Qty, Item,UnitPrice,TotalPrice) and save it to the newly created database(we will call it ItemsDB) but connecting it to the Invoice foreign key so each Item connects to an invoice number which connects to my CustomerDB by a Foreign key CustomerID. Would that work? and i think its a great idea. anyway you can send me that example ?

As Tim mention, one of the advantages of storing data in a database is you can perform analytics on your data. I would think that you would want to store this information in a database as it could be used for trend analysis and future projections.

I would keep Customers, Invoices, Items tables in 1 database and then you could apply a primary / foreign key relationship schema to your design.

@Rich Hatfield Thats what i meant. keep it in one database but 3 different tables linked together by foreign keys.

I think you’ll need 4 tables. Customers, Invoices, Invoice Lines, Inventory Items.

@Tim Hare can you show me how to be able to write to all the tables at the same time and display the info ? not sure how to link everything together. been thinking aobut it for a good second now and i think im just confusing myself alot more. ( or making it harder than it is ) . Example Please ? or an idea?

you don’t write to them at the same time, you’d write/update them in sequence
but you CAN read from them at the same time (as a matter of fact that is what you WANT to do)

If you are not familiar, I would research RELATIONAL DATABASE TABLES, and SQL (you NEED to know SQL)