Re: Outlook 07 Custom Task Form and SQL



Not more control. The same control, but with a different architecture and your choice of programming language, instead of VBScript. Traditional COM add-ins are one solution. Add-ins built with VSTO are another. Both make the project somewhat more complex, as you get into deployment issues.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Job" <Job@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:D51B95F2-A975-4728-8BAD-9155914A0321@xxxxxxxxxxxxxxxx
These add-ins give more control over the development of the form? are you
referring to your site http://www.outlookcode.com/article.aspx?ID=36 or is it
a different kind of add-in via vba or something?

"Sue Mosher [MVP-Outlook]" wrote:

VBScript doesn't support data typing for variable or procedure declarations. You'd need to comment out the As clauses. Also don't forget to declare your ad* constants.

The alternative, BTW, would be to develop an add-in that manages the form's UI, not with code behind the form but through the events that fire when the user interacts with the form.

"Job" <Job@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:52DC9904-BBD2-44BB-87B3-E4E7A6EA8232@xxxxxxxxxxxxxxxx
Hi Sue,

I've used your information a lot trying to solve this..can you look at the
following code. I don't use vbscript much so I'm not sure why I'm getting
the following error.
"Expected end of statement" and it is initially pointing to my dim
statment. If I comment that out it also has the same error on the variable
'e'
Here is the code

Sub FillClientData()

Dim rst As New ADODB.Recordset
Set Conn = New ADODB.Connection
Conn.Open "DSN=db_OCEANS15"

Sql = "Select pj.cl_ClientNum + '_' + cl_Client_Short_Desc From
tbl_prj_Projects pj left join tbl_cl_Clients cl On pj.cl_ClientNum =
cl.cl_ClientNum Where len(pj.cl_ClientNum + '_' + cl_Client_Short_Desc) > 4
Group By pj.cl_ClientNum + '_' + cl_Client_Short_Desc"



Set ctl = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Client")
rst.Open Sql, Conn, adOpenKeyset, adLockOptimistic, Options:=adCmdText


rst.MoveLast
rst.MoveFirst

ReDim MyArray(rst.RecordCount - 1)

For I = 0 To rst.RecordCount - 1

MyArray(I) = rst(0)

rst.MoveNext

Next

For e = 0 To rst.RecordCount - 1

ctl.AddItem MyArray(e)
Next e

'cmbo_Client.List() = MyArray

End Sub

Any help is greatly appreciated

"Sue Mosher [MVP-Outlook]" wrote:

Correct. All code behind an Outlook form must be written in VBScript. The error you're getting suggests either a typo on the page name or the control name. You can narrow down the problem by getting just one object per statement.

"Job" <Job@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:77B141F1-E6DB-43A8-B022-4389319D0F73@xxxxxxxxxxxxxxxx
I've been searching the net finding examples of connecting to a sql db in
order to populate a custom form drop down. I've had my example code in the
vb editor...can I only use the vb script editor? Everytime I reference
Set ctl = Item.GetInspector.ModifiedFormPages("PM
Task").Controls("cmbo_Client")
for example I get the error that the object can't be found.

Cheers,

Job


.



Relevant Pages

  • Re: Outlook 07 Custom Task Form and SQL
    ... Sue Mosher, Outlook MVP ... Sub FillClientData() ... Set Conn = New ADODB.Connection ... Set ctl = Item.GetInspector.ModifiedFormPages("PM ...
    (microsoft.public.outlook.program_forms)
  • Re: Outlook 07 Custom Task Form and SQL
    ... Sue Mosher, Outlook MVP ... Jumpstart for Power Users and Administrators ... Set Conn = New ADODB.Connection ... Set ctl = Item.GetInspector.ModifiedFormPages("PM ...
    (microsoft.public.outlook.program_forms)
  • Re: Outlook 07 Custom Task Form and SQL
    ... Sub FillClientData() ... Set Conn = New ADODB.Connection ... Set ctl = Item.GetInspector.ModifiedFormPages("PM ... Sue Mosher, Outlook MVP ...
    (microsoft.public.outlook.program_forms)
  • Re: Outlook 07 Custom Task Form and SQL
    ... The alternative, BTW, would be to develop an add-in that manages the form's UI, not with code behind the form but through the events that fire when the user interacts with the form. ... Sue Mosher, Outlook MVP ... Jumpstart for Power Users and Administrators ... Set ctl = Item.GetInspector.ModifiedFormPages("PM ...
    (microsoft.public.outlook.program_forms)
  • Re: Customer Outlook Form to Manage Leads
    ... Sue Mosher, Outlook MVP ... Jumpstart for Power Users and Administrators ... the contact form as my template - and modified it from there. ... They'll turn red in the standard folder views when the flag date/time is passed. ...
    (microsoft.public.outlook.program_forms)