Creating views/procedures using ADOX in Access DB 
Author Message
 Creating views/procedures using ADOX in Access DB


I need to create views or stored procedures in an Access database from VB6
code, using ADO/ADOX. "Catalog.Procedures.Append" works fine, but the new
commands dont show up in the "Query" tab when I open the database in Access.
I understand that this is by design, but I'm wondering if there is any other
way to do it, still using only ADOX, and have the created queries appear in
Access? I can't rely on DAO or Access automation, and I get the same result
using DDL "create view" statements...

I'd greatly appreciate any help

Thanks in advance

Thu, 22 Jul 2004 19:33:26 GMT
 Creating views/procedures using ADOX in Access DB

Something isn't quite right; these queries should show up as expected. I
used the following code, with an Access 2000 database, to create a new
procedure and it does appear on the Queries tab:

'-- Begin sample code
Private Sub Command5_Click()
    Dim oCn As New ADODB.Connection
    Dim oCat As New ADOX.Catalog
    Dim oCmd As New ADODB.Command

    oCn.Open "provider=microsoft.jet.oledb.4.0;data
source=c:\northwind.mdb;user id=admin;"

    oCat.ActiveConnection = oCn

    With oCmd
      .CommandText = "SELECT * FROM Customers"
      .CommandType = adCmdText
    End With

    oCat.Procedures.Append "MyNewProc", oCmd


    Set oCn = Nothing
    Set oCat = Nothing

    MsgBox "Proc added successfully.", , App.Title
End Sub
'-- End sample code

Are you using an earlier version of either Access or the Jet OLEDB
provider? Or perhaps the ODBC driver? Try it as above and post the results.

Steven Bras, MCSD
Microsoft Developer Support/Visual Basic WebData

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit

Mon, 26 Jul 2004 07:09:08 GMT
 [ 2 post ] 

 Relevant Pages 

1. Cannot view queries created using ADOX in Access 2000 interface

2. Views Created Using ADOX Are Not Visible in Access 2000

3. Using ACCESS 2000 to create SQL Server view and Store Procedures

4. ADOX Appending a view to an Access 97 db

5. Creating stored procedures using ADOX

6. ADOX and Jet3.5 ( Creating Access 97 Compatible DB )

7. Problem Creating An Access Database Using ADOX

8. Create standart value using ADOX for database Access

9. Creating Access Queries using ADOX

10. Create standart value using ADOX for database Access

11. Creating Access 97 Files Using ADOX

12. ADOX Views.Append Hides View in Access

Powered by phpBB® Forum Software