Visual Basic Database Tutorial - Part 4, Page 2
Right, fellow Visual Basic geeks - this is the section which separates the boys from the men, the girls from the women, and that dodgy unknown down the street from his even dodgier looking brother. Yes, were about to access a database completely in code! Muhahahaha!!
[Ed: Mr Producer, are you SURE we cant cut his contract early?]
The annoying customer services department is on the phone. Again. Theyd like a program into which they can tap a customer ID and have it display the total number of orders for that customer, along with the last order date. Why? To calculate the amount of discount to give, apparently.
So lets start by designing our wizzy Visual Basic form. Heres something I prepared a little earlier:
Quickly knock together the above in your copy of Visual Basic. Ive not set any special properties, just added a few labels and text boxes.
Ive named my three text boxes -
- txtCustID - the one that holds the customer ID
- txtTotalNumber - will display the total number of orders
- txtLastDate - will display the last order date
If you stick with these names, itll make code writing much easier later in this tutorial.
So thats the design out of the way... now we need to think about code.