Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

VB6 beginners tutorial Learn VB6

Advanced VB6 tutorial Learn Advanced VB6


Systems Analysis System analysis and
Design tutorial for
Software Engineering

You are he re : Visual Basic

> VB6 (Beginners Tutorial)


Tutorial Main Page | Previous Page | Contents | Next Page

Creating A Virtual Table


Many times, a database table has more information than we want to
display. Or, perhaps a table does not have all the information we want to
display. For instance, in Example 8-1, seeing the Title and ISBN of a book is
not real informative - we would also like to see the Author, but that
information is not provided by the Titles table. In these cases, we can build
our own virtual table, displaying only the information we want the user to see.

Browse Topics
- Ge tting starte d
- Data Type s
- Module s
- O pe rators in VB6
- VB6 Variable
- VB6 Proce dure s
- VB6 C ontrol Structure s
- Loops in VB6
- VB6 Ex it Do & W ith End
W ith
- Arrays in VB6
- Use r-De fine d Data
Type s
- VB6 C onstants
- VB6 Built-in Functions
- Date and Tim e in VB6
- VB6 C ontrols
- Te x tBox C ontrol
- C om boBox &
O ptionButton
- Labe l & Fram e

- Picture Box & Im age Box


- Tim e r C ontrol

We need to form a different SQL statement in the RecordSource property.


Again, we wont be learning SQL here. We will just give you the proper
statement.
Quick Example: Forming a Virtual Table
1. Well use the results of Example 8-1 to add the Author name to the form.
Replace the RecordSource property of the dtaTitles control with the following
SQL statement:
SELECT Author,Titles.ISBN,Title FROM Authors,[Title Author],Titles
WHERE Authors.Au_ID=[Title Author].Au_ID AND Titles.ISBN=[Title
Author].ISBN ORDER BY Author
This must be typed as a single line in the Command Text (SQL) area that appears when you click the ellipsis by the RecordSource
property. Make sure it is typed in exactly as shown. Make sure there are spaces after SELECT, after Author,Titles.ISBN,Title, after
FROM, after Authors,[Title Author],Titles, after WHERE, after Authors.Au_ID=[Title Author].Au_ID, after AND, after Titles.ISBN=[Title
Author].ISBN, and separating the final three words ORDER BY Author. The program will tell you if you have a syntax error in the SQL
statement, but will give you little or no help in telling you whats wrong.
Heres what this statement does: It selects the Author, Titles.ISBN, and Title fields from the Authors, Title Author, and Titles tables, where
the respective Au_ID and ISBN fields match. It then orders the resulting virtual table, using authors as an index.

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

- Tim e r C ontrol
- ListBox & C om boBox
- VB6 ScrollBar
- C ontrol Arrays in VB6
- File s controls in VB6
- VB6 C he ck Box
- Form s in VB6
- Me nus in VB6
- MDI Form in VB6
- InputBox
- Me ssage Box
- Mouse e ve nts
- Mouse Move
- Error Handling
- Error Handling (2)
- VB6 Database

2. Add a label box and text box to the form, for displaying the author name. Set the control properties.
Label3:
Caption - Author
Text1:
DataSource - dtaTitles (select, dont type)
DataField - Author (select, dont type)
Locked - True
Name - txtAuthor
Text - [Blank]
When done, the form should resemble this:

3. Save, then rerun the application. The authors names will now appear with the book titles and ISBN values. Did you notice you still
havent written any code?
I know you had to type out that long SQL statement, but thats not code, technically speaking. Notice how the books are now ordered
based on an alphabetical listing of authors last names

Tutorial Main Page | Previous Page | Contents | Next Page

Home | Link to Us | About Us | Privacy Policy | Contact Us


Copyright Freetutes.com | All Rights Reserved

open in browser PRO version

Are you a developer? Try out the HTML to PDF API

pdfcrowd.com

You might also like