Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / July 2004

Tip: Looking for answers? Try searching our database.

Trying to get the code to run behind a command button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken - 12 Jul 2004 11:17 GMT
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
Ken Slovak - [MVP - Outlook] - 12 Jul 2004 14:06 GMT
Is your form published? Code won't run on unpublished forms.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.