Visual Basic Database Tutorial - Part 3
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