February 28, 2021
Hot Topics:

Visual Basic Database Tutorial - Part 4

  • By Karl Moore
  • Send Email »
  • More Articles »

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.

Page 2 of 8

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date