Error in Code

M

Micah Chaney

Following is some VBS code I have in my Custom Form developed in Outlook
2003. Line 61 is giving me an error stating:

Object doesn't support this property or method:
'Item.GetInspector.ModifiedFormPages'
Line No: 61

If you look Line 51 is the same method and it works fine. The funny thing is
when I run the code, I get the error, I continue on to the Form, and the
code after it works. The code that follows line 61 is dependent on line 61
as evident by if I ' comment it out, I get a separate error asking for
objPage2. The code also works if I change the value of one of the
subsequent (to line 61) objects to make the If statement true, the "Then"
happens.

It was working before, before that mysterious 3/10 disappearance of my code,
so I can't figure out why it's not working now. Thanks for any help.

Function Item_Open()
Set myNameSpace = Application.GetNameSpace("MAPI")
Item.UserProperties("LoggedIn")=myNameSpace.CurrentUser
'Line 4
if Item.UserProperties("OrderOwner")="--" Then
Item.UserProperties("OrderOwner")=myNameSpace.CurrentUser
end If
'Line 8
Set objPage0 = Item.GetInspector.ModifiedFormPages("Finance")
Set objControl0 = objPage0.Controls("CreditApproval")
Set objControl1 = objPage0.Controls("OrderSizeApproval")
Set objControl2 = objPage0.Controls("ContractApproval")
Set objControl3 = objPage0.Controls("QCApproval")
'Line 14
if Item.UserProperties("LoggedIn")="Mike Green" Then
objControl0.Locked = False
objControl1.Locked = False
objControl2.Locked = False
objControl3.Locked = False
elseif Item.UserProperties("LoggedIn")="Katherine Nelson-Daigle" Then
objControl0.Locked = False
objControl1.Locked = False
objControl2.Locked = False
elseif Item.UserProperties("LoggedIn")="Tim Slevin" Then
objControl1.Locked = False
objControl2.Locked = False
elseif Item.UserProperties("LoggedIn")="Neen Zimmerman" Then
objControl0.Locked = False
elseif Item.UserProperties("LoggedIn")="Lian Hu" Then
objControl0.Locked = False
elseif Item.UserProperties("LoggedIn")="Chris Lundren" Then
objControl1.Locked = False
elseif Item.UserProperties("LoggedIn")="Kirstie Nystedt" Then
objControl3.Locked = False
elseif Item.UserProperties("LoggedIn")="Wade Gordon" Then
objControl3.Locked = False
end If
'Line 38
Set objPage1 = Item.GetInspector.ModifiedFormPages("SalesSupport")
Set objControl4 = objPage1.Controls("CSMgrApproval")
'Line 41
if Item.UserProperties("LoggedIn")="Veronica Eggers" Then
objControl4.Locked = False
end If
'Line 45
End Function
'Line 47
'Line 48
'Line 49
Sub Item_CustomPropertyChange(ByVal Name)
Set objPage1 = Item.GetInspector.ModifiedFormPages("SalesSupport")
Set objControl1a = objPage1.Controls("CSMgrApproval")
Set objControl2a = objPage1.Controls("CSMgrApprovalStore")
Set objControl3a = objPage1.Controls("CSMgrApprovalDate")
'Line 55
if objControl1a <> objControl2a Then
objControl3a.Value = Now()
objControl2a.Value = objControl1a.Value
end If
'Line 60
Set objPage2 = Item.GetInspector.ModifiedFormPages("Finance")
Set objControl1b = objPage2.Controls("CreditApproval")
Set objControl2b = objPage2.Controls("CreditApprovalStore")
Set objControl3b = objPage2.Controls("CreditApprovalDate")
'Line 65
if objControl1b <> objControl2b Then
objControl3b.Value = Now()
objControl2b.Value = objControl1b.Value
end If
'Line 70
Set objControl1c = objPage2.Controls("ContractApproval")
Set objControl2c = objPage2.Controls("ContractApprovalStore")
Set objControl3c = objPage2.Controls("ContractApprovalDate")

'Line 75
if objControl1c <> objControl2c Then
objControl3c.Value = Now()
objControl2c.Value = objControl1c.Value
end If
'Line 80
Set objControl1d = objPage2.Controls("QCApproval")
Set objControl2d = objPage2.Controls("QCApprovalStore")
Set objControl3d = objPage2.Controls("QCApprovalDate")

'Line 85
if objControl1d <> objControl2d Then
objControl3d.Value = Now()
objControl2d.Value = objControl1d.Value
end If
'Line 90
Set objControl1e = objPage2.Controls("OrderSizeApproval")
Set objControl2e = objPage2.Controls("OrderSizeApprovalStore")
Set objControl3e = objPage2.Controls("OrderSizeApprovalDate")

'Line 95
if objControl1e <> objControl2e Then
objControl3e.Value = Now()
objControl2e.Value = objControl1e.Value
end If
End Sub
 
M

Micah Chaney

Also it works in Line 9 -- same Property and same Method. Please help.
Thanks in Advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top