March 4, 2021
Hot Topics:

Visual Basic Database Tutorial - Part 3

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

Sometimes you don't want a database to return every single record. For example, you may simply want to show the orders for one particular customer.

In Microsoft Access, you can specify criteria for a particular field by placing the value underneath the fieldname.

For example, the below query on our Nwind.mdb database shows the ContactName for records where the CompanyName is equal to "France restauration"

When we enter Datasheet View, we get this:

And when we nip into SQL View, we get this:

SELECT Customers.CompanyName, Customers.ContactName
FROM Customers
WHERE (((Customers.CompanyName)="France restauration"));

And that's just saved us having to write and debug our own SQL statement. Access did all that hard work for us.

Top Tip: You will often use SQL statements in your Visual Basic applications. We'll be using them later in this week's tutorial...

Page 3 of 10

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