Creating a Select Query from a VBA Procedure

Now that we've reviewed the basics of using the most popular SQL statement (SELECT), let's get back to ADO and see how you can use the SELECT statement for retrieving records programmatically.

In ADO, queries, SQL statements, views, and stored procedures are represented by the Command object. This object is part of the ADOX Object Model (see Chapter 11, Figure 11-1). The Command object has many properties and methods that will allow you to return records or execute changes to your data (inserts, updates, and deletes). In this chapter you will get to know the properties of the Command object, including: ActiveConnection, CommandText, and

Creating and Running Queries with ADO | 269 Creating and Manipulating Databases with ADO

CommandType. These properties will be discussed as they appear in the example procedure code. You will also learn how to use the Command object's Execute method to run your queries.

The procedure in Hands-On 15-1 demonstrates how to create and save a Select query.

0 0

Post a comment