OK .. i know this has been the topic of much debate and many questions. I have looked thru many of the posts about it and have tried to play around with the code i have.
The short of it is ... i am new to this and dont understand how i am supposed to correct the error.
I have attempted to make a supplier database for work.
In the main form, I figured it would be a good idea to enter a supplier number and auto-populate the supplier name, address, phone etc based on the number.
The plan was to have Notes allow the end user to fill in this info the first time, and every time there-after it would pull the information from a previously created document.
From what I read, GetDocumentByKey seems the way to go here ... and get the info from the 'Vendors' view.
I started by having the SupplierNum field 'Exiting' event populate only the SupplierName field to see if i could get it working, but i am getting 'Object variable not set' error.
The Vendors view has the following sorted named columns:
Number Name Address Phone Fax Contact
Here is my code:
Sub Exiting(Source As Field)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim vNum As String
' first get the supplier number from SupplierNum field - this is set as a text field
Set uidoc = workspace.CurrentDocument
vNum = uidoc.FieldGetText( "SupplierNum" )
' now use the number as the key
Set db = session.CurrentDatabase
Set view = db.GetView( "Vendors" )
Set doc = view.GetDocumentByKey( vNum , True )
Call doc.FieldSetText _
( "SupplierName", doc.SupplierName(0) )
End Sub
According to debugger, it's the last line that is causing the problem:
( "SupplierName", doc.SupplierName(0) )
... and i'm sure it's doc.SupplierName coz i tried specifying it as a string with ""
But i can get it working as a variable ... obviously coz its not set!
But i'm a bit thick today .. so i dont see what its meant to be.
Would really appreciate yur help ..
Many thanks,
DJ

Object variable stuff again - i hav... (D Johnson 13.Feb.06)
. . 