Error : object variable not set

Hi every one!I am a project student, currently having my attachment in a company from my school. I have alittle problem here. I’m trying to do a sequential number. This codes are inside my save&send e-mail button. It kept giving me an ERROR that says OBJECT VARIABLE NOT SET. I checked this mistake, it said that i needed to use “SET”. But what do i need to set? All my “Dim” has been set. Please help me! Thank u for the time and God bless u all.

Sub Click(Source As Button)

Dim wSpace As New notesUIWorkspace

Dim uidoc As NotesUIDocument 

Dim doc As NotesDocument 

Set uidoc = wSpace.CurrentDocument 

Set doc = uidoc.Document 



Dim session As New NotesSession 

Dim db As notesdatabase

Dim view As NotesView 

Dim newdoc As NotesDocument

Dim docB As NotesDocument 

Dim rt As NotesRichTextItem 



Set db=session.CurrentDatabase

Set newdoc=New notesdocument(db)

Set view = db.GetView("SV")	

Set docB = view.GetDocumentByKey ("fNumber") 

Set rt = New NotesRichTextItem (newdoc, "Body")



Dim n As Integer 

n=docB.FormNumbers(0)

Call uidoc.Refresh 



'get new ID Number

If doc.IsNewNote Then 

	n=n+1

	num = "Form Number" & Right ("0000"&n,4)

	doc.fNumber = num

	docB.FormNumbers = n

	Call docB.Save (True,False)

	doc.ProcessStatus = "1"

	

End If

Call rt.AppendDocLink(doc,"Sales Form") 'form attached



newdoc.form = "Sales Form"

newdoc.from = "Put from name here or ignore if you want to show your name"

newdoc.sendto = doc.PersonToConfirm

newdoc.subject = "Sales Form" & " " & uidoc.FieldGetText("custName")



Call rt.AppendText ("Attachments is for you to approve") 'body text

Call rt.AddNewline(2) 'create new line



'Save documents

Call uidoc.Save 



newdoc.form = "Bookmark"

Call newdoc.Send (YES, doc.PersonToConfirm)



'If doc.IsNewNote Then

	'n = n + 1

	'num = "Form Number" & Right("0000" & n , 4)

	'docA.fNumber = num    ' in the main

	'docB.formNo = n            ' in the FN

	'Call docB.Save( True, False )

	'docA.ProcessStatus = "Save & Send Form"

'End If

Messagebox "Email was sent ",0+64, "Success!"



Call uidoc.Close 

End Sub

Subject: ERROR : OBJECT VARIABLE NOT SET

Hi,Use debugger, he will show you which line rise the error… very helpful tool when you begin …

Subject: RE: ERROR : OBJECT VARIABLE NOT SET

AAAAAAAAAAAAAYYYYYYYYYYYOOOOOOOOOO thank u Jean.Just realise that there is a debugger in lotus notes man. I usually used vb.net, there is an icon for it. hehehehehe. BTW i know what’s wrong or which line it stopped. But yet what do i need to set from this line? You have any ideas?It’s this one ----> “n = docB.FormNumbers(0)”

What is the problem ya???

Subject: RE: ERROR : OBJECT VARIABLE NOT SET

hi from my home,certainly docb was not found !!! if you look at the object docb in debugger, he is empty, and so you can not instanciate !!

o’right Cong Ta ?

if any problem to go faster : my email : jm at monin.net

Subject: RE: ERROR : OBJECT VARIABLE NOT SET

Subject: RE: ERROR : OBJECT VARIABLE NOT SET

Please see this article (this is part 2; see also part 1) for guidance on debugging and advice about the specific error message.

Subject: RE: ERROR : OBJECT VARIABLE NOT SET

Wahhh, i need this article too man. Got to learn how to debug.