Microsoft Office Tutorials and References
In Depth Information
SQL and Recordsets
ForwardOnly Cursor
This constant is the same as Static Cursor, but the
cursor moves only forward through the table. This
setting is the default if you don’t specify a cursor
This constant is like Dynamic Cursor, but records
added by other users aren’t added to the
recordset. Records deleted by other users are
inaccessible to your recordset.
The .RecordCount and .AbsolutePosition properties return correct
values only when you’re using a Static Cursor type, which is another reason
why we use adOpenStatic as the cursor type in our examples. When you’re
using a Dynamic Cursor, .RecordCount and .AbsolutePosition always
return -1, because the number and positions of the records in the recordset
may change — which could cause you to accidentally change the wrong
Using field names in recordsets
In a recordset, each record is a collection of fields. You can refer to fields by
their positions in the record. myRecordset.Fields(0) refers to the first
field in the record, myRecordset.Fields(1) refers to the second field,
and so on. You can also refer to fields by their names. The syntax is
myRecordset.Fields(“ fieldname ”)
fieldname is the name of the field as defined in the table. You must type the
fieldname exactly as it appears in the table’s Design view (including spaces).
SQL and Recordsets
You don’t have to base a recordset on a single table; you can base it on a
query, if you like. You can’t use the query’s name in the myRecordset.Open
statement, however, because only table names are allowed there. If you want
to base a recordset on a query, you need to use the query’s SQL statement
to create the query.
Chapter 5
SQL (pronounced see -quel) stands for Structured Query Language. You can’t
get very far in database management without hearing some reference to
SQL, because SQL is the standard language for extracting information from
data stored in Access, Microsoft SQL Server, Oracle, and a whole bunch of
other database products.
Search JabSto ::

Custom Search