Link to home
Start Free TrialLog in
Avatar of jforget1

asked on

Object Variable Not Set

Have a strange one here. Have an agent that I have used in the past to send out emails to users. THe issue that I have is there is a field with their office ID. The field type is Text and I have dimmed it as a string. The cause I think here is the value in the field is all numbers (e.g. 123) Would that alone cause a type mismatch even though the field type is set to Text? In the Declarations for the agent it is coded Dim Agency As String

My break is happening on this line  
emaildoc.Subject = doc.Agency + " has devices to replace."

Any tips?
Sub Initialize
	Dim s As New NotesSession 
	Set db = s.CurrentDatabase 
	Set v = db.getview("out_of_scope_nef")
	Set vnav = v.createviewnav
	Set ventry = vnav.getfirst
'Process uniform information for all docs in office
	Do Until ventry Is Nothing  
' Build the top of the document
		arraycount = 0
		saveoffice = ventry.columnvalues(0)
		Set emaildoc = db.CreateDocument 
		emaildoc.form = "out_scope_letter_om_nef"           'Form name of Letter 
		emaildoc.SendTo =  ventry.columnvalues(1) 
		emaildoc.CopyTo =  ventry.columnvalues(2) 

		Call RedimArrays
		username(arraycount) = ventry.columnvalues(3)
		dai(arraycount) = ventry.columnvalues(4)
		desc(arraycount) = ventry.columnvalues(5)
		svc_tag(arraycount) = ventry.columnvalues(6)
		status(arraycount) = ventry.columnvalues(7)
		Arraycount = arraycount + 1
	' Set flag on original document being processed
		Set doc = ventry.document
		doc.om_letter1_flag = "done"
		Call, True)
		Set ventry = vnav.getnext(ventry)
		If ventry Is Nothing Then Goto WriteLast
		If ventry.columnvalues(0) = saveoffice Then 
			Goto ProcessEntry
			emaildoc.username = username
			emaildoc.dai = dai
			emaildoc.Agency = Agency
			emaildoc.desc = desc
			emaildoc.svc_tag = svc_tag
			emaildoc.status = status
			emaildoc.Agency = doc.Agency
			emaildoc.Principal = "Field Technology"
			emaildoc.Subject = doc.Agency + " has devices to replace."
			Call emaildoc.send(True)
			arraycount = 0
			Call CleanArrays
		End If
End Sub

Open in new window

Avatar of Bill-Hanson
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jforget1


Tried your second suggestion and it worked perfectly. Really appreciate the quick response as always.
Great suggestions as always.