ch07wk1

Lemur zaprasza

Week 1

In Review

Day 1: Your First Database Program in Visual Basic 5
Day 2: Creating Databases
Day 3: Visual Basic Database Objects
Day 4: Creating Data Entry Forms with Bound Controls
Day 5: Input Validation
Day 6: Creating Reports with Crystal Reports Pro
Day 7: Using the Visdata Program







Week 1
In Review
In the first week, you learned about the relational database model, how to use
the Visual Basic database objects to access and update existing databases, and how
to use the Visual Data Manager (Visdata) program to create and maintain databases.
You also learned how to design and code data entry forms, including use of the Visual
Basic bound data controls, and how to create input validation routines at the keystroke,
field, and form levels. Finally, you learned how to use the Visual Basic Crystal
Reports Pro report writer to design simple reports, and you learned how to use the
CRYSTAL.VBX control to run those reports from within your Visual Basic programs.
Day 1: Your First
Database Program in Visual Basic 5
The first day's lesson gave you a crash course in how to build a fully functional
data entry form in Visual Basic with minimal programming code. On Day 1, you learned
the following:


How to use the data control to bind a form to a database and data table by setting
the DatabaseName and RecordSource properties

How to use the Text box bound input control to bind an input box on the form
to a data table and data field by setting the DataSource and DataField properties

How to combine standard command buttons and the AddNew and Delete
methods to provide Add and Delete record functionality to a data entry form


Day 2: Creating Databases
The lesson on Day 2 concentrated on the fundamentals of relational databases.
You learned the following about relational databases:


A relational database is a collection of related data.

The three key building blocks of relational databases are data fields, data records,
and data tables.

The two types of database relationships are one-to-one (which uses qualifier
fields) and one-to-many (which uses pointer fields).

There are two types of key (or index) fields: primary and foreign.


You also learned the 14 basic data field types recognized by Visual Basic 5. You
constructed a data entry form that allows you to test the way Visual Basic behaves
when attempting to store data entered into the various data field types.
Day 3: Visual Basic
Database Objects
In Day 3's lesson, you learned that there are three main types of Visual Basic
Recordset data objects:


Table-type objects: These are used when you have a large dataset and need to
do frequent searches to locate a single record. You can use the Visual Basic Seek
method and use Visual Basic Indexes with the Table object.

Dynaset-type objects: These are used in most cases when you need read and write
access to datasets. The Dynaset uses little workstation memory and allows you to
create virtual tables by combining fields from different tables in the same database.
The Dynaset is the only data object that allows you to read and write to ODBC data
sources.

Snapshot-type objects: These are used when you need fast read-only access to
datasets. Snapshot objects are stored in workstation memory, so they should be kept
small. Snapshots are good for storing validation lists at the workstation or for
small reports.


You also learned about another data object--the Database object. You can use the
Database object to get a list of tables in the database, a list of indexes associated
with the tables, and a list of fields in each of the tables.
Day 4: Creating Data
Entry Forms with Bound Controls
On Day 4, you learned about creating data entry forms with Visual Basic bound
data controls.
You learned that the Visual Basic data control has five database-related properties.
Three refer to the database and two refer to the Dynaset.
The Database properties of the Visual Basic data control are


DatabaseName: Used to select the database to access

Exclusive: Used to prevent others from opening the database

ReadOnly: Used to prevent your program from modifying the data in the database


The Dynaset properties of the Visual Basic data control are


RecordSource: Used to select the data table within the database

Options: Used to set ReadOnly, DenyWrite, and AppendOnly properties for the Dynaset


You learned that the Visual Basic data control has three database-related methods:


Refresh: Used to update the data control after setting properties

UpdateControls: Used to read values from the fields in the Dynaset and
write those values to the related form controls

UpdateRecord: Used to read values from the form controls and write those
values to the related fields in the Dynaset


You learned that the Visual Basic data control has three database-related events:


Reposition: Occurs each time the record pointer is moved to a new record
in the Dynaset

Validate: Occurs each time the record pointer leaves the current record
in the Dynaset

Error: Occurs each time a database error occurs


You learned how to use Visual Basic-bound form controls to link form input and
display controls to data fields in the database.


Bound textbox control: Used for data entry on character and numeric data table
fields

Bound label control: Used for display-only character and numeric data table fields

Bound checkbox control: Used for data entry on the BOOLEAN data type field

Bound image control: Used to display images stored in the BINARY data type field

The 3D panel control behaves the same as the label control, and the 3D checkbox
control behaves the same as a standard checkbox control


You also learned several general rules for creating Visual Basic forms in the
Windows 95 style:


The default color is light gray for backgrounds.

Use the panel3D control to create a palette on which to place all other controls.

The default font is 8-point sans serif, regular.

Input areas should have a background that is white; display areas should have
a background that is light gray. Display areas should be recessed into the input
palette.

Use frame controls to group related items on a form.

Left-justify all controls, including field prompts. Field prompts should be written
in mixed case and followed by a semicolon.

Standard spacing and sizing for common controls are as follows:

Control height is 330 twips.

Command button width is 1200 twips.

Vertical spacing between controls is 90 twips for related items and 210 twips
for unrelated items.

Border widths (top, bottom, and side) should be 120 twips.


Lastly, you learned how to write code that sets control colors to the Windows
95 default colors, how to create your own custom color scheme, and how to link your
control colors to the color scheme selected with the Windows Control Panel color
applet.
Day 5: Input Validation
On Day 5, you learned how to perform input validation on data entry forms. You
learned that input validation tasks can be divided into three areas:


Key filtering: Preventing unwanted keyboard input

Field-level validation: Validating input for each field

Form-level validation: Validating input across several fields


You also learned that you should ask yourself a few basic questions when you are
developing validation rules for your form.


Is it a required field?

What characters are valid/invalid for this field? (Numeric input only, capital
letters only, no spaces allowed, and so on.)

For numeric fields, is there a high/low range limit? (Must be greater than zero
and less than 1000, can't be less than 100, and so on.)

Is there a list of valid values for this field? (Can the user enter only Retail,
Wholesale, or Other; Name must already be in the Customer table, and so on.)

Is this a conditional field? (If users enter Yes in field A, they must enter
something in field C.)


You learned how to write keyboard filter validation functions using the Visual
Basic 5 KeyPress event. You learned how to write field-level validation
functions that check for valid input ranges, input that is part of a list of valid
data, and input that is within minimum and maximum length requirements. You also
learned how to write validation functions that make sure dependent fields have been
filled out properly.
Finally, you learned how to use Visual Basic 5 to create your own custom control
that incorporates all the validation techniques you learned in this chapter. You
can use this ActiveX control in all your future Visual Basic projects.
You also applied your knowledge of bound data controls, Visual Basic 5 data entry
form design, and validation processing to create the data entry form for the CompanyMaster
data table.
Day 6: Creating Reports
with Crystal Reports Pro
On Day 6, you learned how to use Crystal Reports Pro to create a simple list report
using the data tables you created earlier in the week. You also learned that Crystal
Reports Pro is a banded report writer. These are the main bands in a report:


Header and Footer bands appear on every page.

Detail bands contain the equivalent of a data table record.

Section bands contain subtotals or groupings of the data.


You also learned that Crystal Reports Pro recognizes three types of fields on
the report form:


Database fields are from attached data tables.

Text fields are literal text created by the user.

Formula fields are calculated fields created by the user.


You also learned how to use the CRYSTAL.VBX control to run a report from within
your Visual Basic program. Finally, you created a generic print report dialog that
lets you control the report destination, file type, and number of copies.
Day 7: Using the
Visdata Program
You wrapped up your first week of study by learning how to use the Visdata sample
application to perform all the basic database operations needed to create and maintain
databases for your Visual Basic 5 applications.
You learned how to:


Open existing databases

Create new databases

Add tables and indexes to existing databases

Attach external data sources to existing Microsoft Access databases

Access data using the three data access objects: Table, Dynaset, and Snapshot

View data on-screen using the three data forms: form view with the data control;
form view without the data control; and grid view using the data-bound grid

Build and store SQL queries using the Query Builder


You learned to use Visdata to perform database utility operations, including:


Copying tables from one database to another.

Repairing corrupted Microsoft Access (Jet) databases.

Compacting and converting versions of Microsoft Jet databases.

Performing global replace operations on tables.


You learned to use Visdata to adjust various system settings that affect how Visual
Basic 5 displays data tables and processes local and external database connections
and parameters that control how Visual Basic 5 locks records at update time.
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • teen-mushing.xlx.pl
  • Wątki
    Powered by wordpress | Theme: simpletex | © Lemur zaprasza