More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 24-Jun-2019 08:23

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

    Page [ 1 2 3 4 5 6 Next >> ]  
 Outlook Expert Techniques Printer Friendly Version
Working with toolbars, menus, ribbon; generating custom reports; deploying forms; connecting to databases, Exchange folders, and XML Web services
Need Help In Database
Can anyone tell me what should I do or what should I install or what settings should I do to connect the Outlook to the Database?


  26-Apr-2007  21:15
  26-Apr-2007  22:21   
See if the information at gets you started.
  29-Apr-2007  05:44   
Is there a way to check whether you have connected to the database?
  29-Apr-2007  08:06   
If you're using ADO, check the value of the State property of the connection. If it's adStateOpen (= 1), then you know it's open.

Or, assume it's open and use On Error Resume Next to help you handle errors.
  29-Apr-2007  21:04   
Hmm. I wrote this code. I make a button clicked to test whether am I connected to the database but the wierd thing is the msgbox shows that Connection Failed but it was able to select the data in the recordset.

Sub Test_Click()

    Dim ADOConn
    Set ADOConn = CreateObject("ADODB.Connection")

    ADOConn.Provider = "Microsoft.JET.OLEDB.4.0"
    ADOConn.Open "C:\Users\interm\Documents\Database\Task Data.mdb"

    If ADOConn.State = adStateOpen Then

    MsgBox "Connection Established"


    MsgBox "Connection Failed"

    End If

    Dim rs

    Set rs = ADOConn.Execute("SELECT * FROM Data")

    MsgBox rs("ID") & " " & rs("Subject") & " " & rs("Problem Type")


End Sub
  30-Apr-2007  00:31   
One more thing about my code is that sometimes it display as Connection Failed and sometimes display Connection Established but most of the time is Failed. If it display Connection Failed, the msgbox show the recordset that I wanted but if Connection Established, error msg will come out and say "Operation is not allowed when object is closed". What is wrong?
  30-Apr-2007  06:54   
This is custom form code? Did you declare a constant for adStateOpen in the declaration section of your script? Remember that VBScript knows only about vb* constants, not ol* or ad* constants.

Also check your provider string. Do you need to give user ID and password?
  30-Apr-2007  08:04   
Yes. This is my custom form code. How to declare constant adStateOpen? What you mean about need to give ID and password, is it needed for the accessing the database u mean?
  30-Apr-2007  10:44   
This is the basic format for declaring a constant in VBScript:

    Const adStateOpen = 1

If the database requires a user ID and password, you need to provide those in the connection string. The page I suggested has links to references on connection strings.
  30-Apr-2007  11:48   
Oh. I do not need a user ID and password, I can access it just fine so I don't need to include it right?
  30-Apr-2007  12:29   
That would be a logical conclusion.
    Page [ 1 2 3 4 5 6 Next >> ]