I am trying to execute code when a command button is clicked on a
custom form that I am using within Outlook 2000, but the code doesnt
seem to be working I have put a msgbox command in the code and it does
nothing. Is my procedure named wrong or do I have to do another step
? I'm New at this so any help is appreciated.
The code is meant to update an access database with information from
the form on the read page.
Thanks in advance.
Ken
Command button name:cmdUpdateDatabase
Code:
Private Sub cmdUpdateDatabase_Click()
Set dbe = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
strPath = "J:\XXXXX\Job Database.mdb"
strJob = Item.UserProperties.Find("Job Name").Value
msgBox strJob
dbe.Mode = 3
dbe.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=strPath;"
strSQL = "INSERT INTO tblJobLoad (Jobname) VALUES (" & strJob & ");"
rs.Open strSQL,dbe,2,3
dbe.Close
rs.Close
End Sub
Pervov Paul - 17 Jul 2004 13:54 GMT
Ken.
I beleive Private/Public modificators do nothing in VBScript used within
Outlook form automation, but remove it.
Also, try to insert MsgBox righht after function header and watch if your
code is executed at all.
Paul.
P.S. Hope this helps.
> I am trying to execute code when a command button is clicked on a
> custom form that I am using within Outlook 2000, but the code doesnt
[quoted text clipped - 25 lines]
>
> End Sub
Sue Mosher [MVP-Outlook] - 19 Jul 2004 15:44 GMT
Where did you publish the form? Code doesn't run on unpublished forms. Is
the command button actually named "cmdUpdateDatabase"?

Signature
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> I am trying to execute code when a command button is clicked on a
> custom form that I am using within Outlook 2000, but the code doesnt
[quoted text clipped - 25 lines]
>
> End Sub