[AccessD] ADO

Charlotte Foust cfoust at infostatsystems.com
Mon Nov 26 12:58:41 CST 2007


Just for fun, here's an old routine I built to create a query using ADO:

'Sample call:

'CreateQuery "c:\Program Files\Microsoft
Office\Office\Samples\Northwind.mdb", _
'   "SELECT Products.* FROM Products WHERE Products.CategoryID=1;", _
'   "AllBeverages"

Sub CreateQuery(strDBPath As String, _
                strSQL As String, _
                strQryName As String)
   'Created by Charlotte Foust
   'Appends a new view to the specified database
   'from the SQL string passed
   Dim catDB As ADOX.Catalog
   Dim cmd   As ADODB.Command
    
   'instantiate the objects 
   Set catDB = New ADOX.Catalog
 
   'Define a Command object to contain the query's 
   'SQL.   
   Set cmd = New ADODB.Command  

   'Open the catalog.  
   catDB.ActiveConnection = CurrentProject.Connection  

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Monday, November 26, 2007 9:55 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] ADO


> But you can use a fixed query in ADO.

=====Can you reference the field properties? That's what I'm doing. 

Susan H. 
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list