Microsoft Office Tutorials and References
In Depth Information
The Command Object
The Open method opens the Recordset object so you can access the data. Its syntax is
recordset.Open Source, ActiveConnection, CursorType, LockType, Options
Note that the Source argument is often a string that names the table from which the
recordset should be retrieved.
The Close method closes an open Recordset object. With the Recordset object declared as
dbRecordset , the syntax for Close would be
The command object
The Command object holds information about the kind of task being run, which is usually related to
action queries in Access, or procedures in SQL, which are described in the next section. A Command
object can also return a list of data records, and is most often run with a combination of
parameters, of which there are more than this lesson can possibly cover.
The Command object has three important properties:
The ActiveConnection property, which, like the ActiveConnection property for the
Recordset object, is a connection string or a Connection object that identifies the
connection being used to access the database. For example, this syntax assigns a Connection object
to the ActiveConnection property, where objRecordset and objConnection are object
Set objRecordset.ActiveConnection = objConnection
The CommandText property, which sets the command that will be executed by the database,
and will usually be an SQL string.
The CommandType property, which tells the database how to interpret and execute the
CommandText ’s instructions.
An inTroducTion To sTrucTurEd quEry lAnguAgE (sql)
Structured Query Language (SQL) is a database language used in querying, updating, and managing
relational databases. SQL is used to communicate with the vast majority of databases that are
commonly in use today.
Structured Query Language is a complex language in response to the rigid nature of table design in
relational database construction. This lesson covers SQL’s four basic operations of SELECT , INSERT ,
UPDATE , and DELETE . As a reminder of what I mentioned at the beginning of this lesson, you’ll find
several examples of these operations in Lesson 29 that show how to work with Access from Excel.
Search JabSto ::

Custom Search