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
..
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
..