export from Outlook to secured Access database using ADO

W

wouter

Hello,

I'm using this code to export entries on an Outlook Form
to an secured Access Database by pressing a button on the
Outlook Form, but it won't work. I already posted this one
in the Outlook Programming Newsgroup and people advised me
to post it here as well.

The code fragment is Outlook's VB script, not Access's VBA.

***********************************************************
****
Sub Button_Click()

Set Conn = Application.CreateObject("ADODB.Connection")
Set rst = Application.CreateObject("ADODB.Recordset")

With Conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Mode = adModeReadWrite
.Properties("Jet OLEDB:System Database")
= "I:\DATABASE.MDW"
.Open "Data Source=I:\DATABASE.mdb;User
ID=user;Password=password;"
End With

Set rst = Conn.Execute("SELECT * FROM tbl_Mail")

With rst
.AddNew
.Subject = Item.Subject
etc
.Update
.Close
End With

Set rst = Nothing
Set Conn = Nothing

End Sub
***********************************************************
****

The error I recieve is as follows: "Microsoft Outlook -
Object or Provider is not capable of performing requested
operation"

The probleem seems to be the "AddNew" command, because I
use a simular piece of code to fill a bunch of comboboxes
on the same Outlook form with data from the same Access
database. This piece of code does not use "AddNew" and
works fine.

I came across a Microsoft KB article that stated that ADO
has only read permissions and DAO has read/write
permissions, but I couldn't get the database connection to
the secured database working with DAO, so instead I used
ADO.

Any suggestions?
TIA, Wouter
..
 
A

Alex Dybenko

i can tell you how to connect to secured mdb using dao:

Dim wrk As DAO.Workspace
DBEngine.SystemDB = "I:\DATABASE.MDW"
Set wrk = DBEngine.CreateWorkspace("", "User", "Password", dbUseJet)
Set db = wrk.OpenDatabase("I:\DATABASE.mdb")


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top