Link to home
Start Free TrialLog in
Avatar of thediplomat87
thediplomat87Flag for United States of America

asked on

Outlook email Form

I have a microsoft outlook custom email form that i created to standardize requests. Until recently the form loaded within about 5-10 seconds tops. Now it is taking closer to 30-40 seconds for it to load, and I have been getting frequent complaints about it. I haven't changed anything on the forms, and it seems as though out of the blue it just started loading slower 1 day. This form is loaded into 10 people's personal forms libraries (our company does not want the organizational forms library used.) I have tried to take out as much of the on load vbscript as possible, but it does not seem to make any difference. Any help will be much appreciated. Thanks!
Avatar of greenhacks
greenhacks
Flag of India image

Does it have any dependency to pull data from some database when it loads?
Avatar of thediplomat87

ASKER

No, there is a button on the form which will send the contents of the form to the database but none of that code is tied to opening the form. Right now the when the form opens it will set:
1) the request date (today if prior to 4pm otherwise tomorrow)
2) check current user to determine if it is an administrator (there are 5 admin users), and set certain frame visiblity accordingly (I hard coded in the admin user names because i thought that would make it go faster then creating an admin table in a database and having it link to that
3) calls a function to fill in the net working days. which is a rather small function.
Here is the vbscript for the form load function and the work days function. Sorry I forgot to attach it when I asked initially.
Function Item_Open()
' THIS CODES RUNS UPON RUNNING THE FORM
	' Determines the effective requestdate
	' this will recognize that the effective requestdate for requests placed after 4PM 
	' are effectively requested the next day
	' and that request placed on weekends are effectively placed on Monday
 
Dim RequestDate 'as date
Dim ERequestDate 'as date
Dim StrERequestDate 'as string
 
	RequestDate = Now()
	Item.Userproperties("RequestDate") = RequestDate
	if DatePart("h", RequestDate)>13 then
		StrERequestDate=Cstr(DateValue(RequestDate+1)) & " 08:00 AM"
		ERequestDate = CDate(StrERequestDate)
	Else
		ERequestDate = RequestDate
	End if
	
	if IsWeekend(ERequestDate) then
		ERequestDate = NextBusinessDay(ERequestDate, 1)
		StrERequestDate=Cstr(DateValue(ERequestDate)) & " 08:00 AM"
		ERequestDate = CDate(StrERequestDate)
	End if
Item.Userproperties("EffectiveRequestDate")=ERequestDate
 
REM From http://www.outlookcode.com/threads.aspx?forumid=3&messageid=673
Dim user
Set myInspector = Item.GetInspector.ModifiedFormPages("Message")
user = Application.GetNameSpace("MAPI").CurrentUser 
 
 
REM THIS ESTABLISHES AN ANDMINISTRATOR VIEW OR USER VIEW
if user = "admin1" or user= "admin2" or user= "admin3" or user= "admin4" or user= "admin5" Then 	
		myInspector.Controls("Frame11").Visible =True
		myinspector.controls("Textbox64").Visible = True	
		myinspector.controls("Label51").Visible = True
		myinspector.controls("Textbox74").Visible = True	
		myinspector.controls("Label75").Visible = True
Else			
		myInspector.Controls("Frame11").Visible= False
		myinspector.controls("Textbox64").Visible = False
		myinspector.controls("Label51").Visible = False
		myinspector.controls("Textbox74").Visible = False	
		myinspector.controls("Label75").Visible = False
End if		
 
REM When Admin opens up filled out request the right 
Rem questions and answers have to be visible.
 
if item.Userproperties("checkbox")= true then
	myInspector.Controls("Frame14").Visible =True
End if
 
myinspector.controls("CommandButton6").Visible = false
myinspector.controls("_RecipientControl1").setfocus
workdays=NetWorkDaysWithSats(Item.UserProperties("EffectiveRequestDate"),Item.UserProperties("DueDate"))
Item.userproperties("Working Days")= workdays 
 
End Function
'***************************************************************************************
Function NetWorkDaysWithSats(start,finish) 
Rem adapted from http://www.ozgrid.com/forum/showthread.php?t=28948
 
Dim x 'As Integer 
Dim z 'As Integer 
i = Finish - Start 
 
For x = 0 To i 
	If Weekday(start+x, vbMonday) >1 and Weekday(start+x, vbMonday) < 7 Then 
		z = z + 1 
	End If 
Next 
NetWorkDaysWithSats = z 
 
End Function 

Open in new window

Avatar of David Lee
Hi, thediplomat87.

What version of Outlook are you using?  Did anything change immediately before this started having problems?
I am using Outlook 2007, and as far as I know nothing changed when the form started loading slower.
SOLUTION
Avatar of greenhacks
greenhacks
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes it is exchange. I'm not aware of any Outlook related policies (I have a close out form which is very similar which loads promptly. And I havent rebuilt any user, but since it has slowed down we have added it to other computers who experience the same issue. Since the slow down we added 1 user and 1 admin.
Have you tried flushing the form cache?  How about adding code to determine where it's slowing down at?  
i cleared the form cache. what code would I add. I tried publishing another copy of it which has not on open events at all and it still takes the same amount of time
That narrows things down a bit.  If it isn't the code, then there's nothing I can think of that you can test with.  Is it slow to open in the designer?
Yes if you are in design view, and hit run this code. it will take about the same amount of time to run as if you are opening it through choose forms.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nothing overly special. There are the usual a few comboboxes, checkboxes, textboxes, and some buttons which do the following.
1) Pull ID number from database
2) Send data on form to database
3) Send it to the calendar
4) update date on calendar button
5) update text fields
6) move from inbox to stored folder

then the 2 other buttons just flip between the 1st and 2nd page of the message.
I dont see any of these as being special since there are similar buttons on my other email forms. I could be mistaken on that fact though.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial