Outlook2003 Forms Help:(MSDN)
http://msdn2.microsoft.com/en-us/library/aa294474(office.11).aspx
Microsoft Outlook Programming ----Book:
http://books.google.co.uk/books?id=bw4Bw0idUCgC&pg=PA361&lpg=PA361&dq=outlook+choose+a+form+add+event&source=web&ots=m0xuX-crKq&sig=SsFd6AGu_OhkICGZQ5j1fYDRrHY&hl=en#PPA5,M1
示例代码:
IDE: Script Editor
Set conn=Createobject("adodb.connection")
connStr = "Driver={SQL Server};DataBase=FormDatabase;Server=ZZT-PC\SQLEXPRESS;UID=user;PWD=password"
conn.Open connStr
Function Item_Open()
Set cboServiceType = Item.GetInspector.ModifiedFormPages.Item("Message").Controls("cboServiceType")
Set rs =Createobject("adodb.recordset")
sql = "select * from ServiceType"
rs.Open sql, conn, 3, 3
Do While Not rs.EOF
'MsgBox (rs("ServiceTypeName"))
cboServiceType.AddItem rs("ServiceTypeName")
rs.MoveNext
Loop
End Function
Sub Item_CustomPropertyChange(ByVal Name)
If Name="MyCategory" Then Exit Sub
Set cboServiceType = Item.GetInspector.ModifiedFormPages.Item("Message").Controls("cboServiceType")
Set cboCategory = Item.GetInspector.ModifiedFormPages.Item("Message").Controls("cboCategory")
cboCategory.Clear
'MsgBox "="&cboServiceType.value
'MsgBox Name
Set rs =Createobject("adodb.recordset")
sql = "select * from Category,ServiceType where Category.ServiceTypeId=ServiceType.ServiceTypeId and ServiceType.ServiceTypeName='"&cboServiceType.value&"'"
rs.Open sql, conn, 3, 3
Do While Not rs.EOF
'MsgBox (rs("ServiceTypeName"))
cboCategory.AddItem rs("CategoryName")
rs.MoveNext
Loop
End Sub