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 doc.save(True, 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

Lotus IBM

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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

Great suggestions as always.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes