Error creating product object

Hi, i want to create an agent that gives some messages corresponding to field named tarih in a form (not multivaluable field). tarih field contains that date in future date. agent checks if date difference between value of tarih field and today is 1 then agent gives a pop-up messages. the code i wrote is below but when it executed it gives that “Error creating product object”. Please check that where i am making mistake.

Sub Initialize

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim doc As NotesDocument 

Dim db As NotesDatabase 

Dim view As NotesView



On Error Goto Quit



Set db = session.GetDatabase(db.Server,db.FileName)

'Change this view to your view

Set view = db.GetView("isemirleri") 

Set doc = view.GetFirstDocument

dd% = (-1)*(Day(Today) - Day(Cdat(doc.tarih(0))))

If Sgn(dd%) = -1 Then

	dd%= (-1)*dd%

Elseif Sgn(dd%) = 0 Then

	dd% = dd% * 1

Else 

	dd% = dd% * 1

End If

While Not doc Is Nothing

	If dd% = 1 Then

		Call winmessage ( "Server not found",0+64,"Error" ,"5")

	End If

	Print Cstr(doc.tarih(0))

	Set doc = view.GetNextDocument(doc)

Wend

Exit Sub

Quit:

Msgbox Error & " at line: " & Erl

End Sub

Thanks in advance

Regards

Özcan Arslan

Subject: First error is on this line: Set db = session.GetDatabase(db.Server,db.FileName)

It should probably be: Set db = session.CurrentDatabase

Subject: When posting LS error questions DEBUG FIRST please!

and tell us which line generated the error so that we know where to look instead of having to parse through all your code.