Results 1 to 3 of 3

Thread: DAO Create Query to ADO ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    South Africa
    Posts
    3

    Post

    Hi, heres a question for the ADO gurus.
    I'm porting an application from dao to ado. The application is a mail merge utility, that creates a database, which Word 2000 in turn links into to access the contacts list.

    With DAO, I have been able to create a specific query thru code, which Word then accesses. The question is, how do I get ADO to create this query? Learning the ADO syntax has already got me all "be-fuddled", so any code examples will be much appreciated.

    Summary of what i need to do is: Use ADO to dyamically create a permanent Query on an Access 2000 database, using code. All help and snippets of wisdom appreciated!

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    South Africa
    Posts
    3

    Post

    Here's something strange!!! I'm answering my own question...er...for anyone else who might be interested.Sub ADOCreateQuery()

    Dim cat As New ADOX.Catalog
    Dim cmd As New ADODB.Command
    'Open the catalog cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\nwind.mdb;"
    'Create the query
    cmd.CommandText = "Select * FROM Categories"
    cat.Views.Append "AllCategories", cmd
    Set cat = Nothing
    End Sub

    Found an excellent guied to ADO on Microsoft's website, very detailed and simple explaining the syntax clearly. If anyone wants a copy of this 11 page HTML file, you can email me at [email protected].
    Cheers


  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 1999
    Location
    South Africa
    Posts
    3

    Post

    Help again!

    using the above code generates and saves the query(view) in the access database, but does not expose the query to Access.

    Using DAO with the exact same procedure style exposes the Query nicely, so I can use Word to access the Query.

    Any ideas on how to get this ADO View to be exposed as a query in Access 2000?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width