Database has not been open yet

Hi I need to copy the current document into another database,For that i am using copytodatabase method,but it is giving me error on

Set newdoc = doc.copytodatabase(copyDb)

My Both the databases are same,but they are not replica.

my code is:

Call Uidoc.save

Dim copyDb As notesdatabase

Path=“Test\mast,.nsf”

Set copydb = New notesdatabase(“”, path)

Call copydb.Open( “”, path )

Dim newdoc As notesdocument

Set newdoc = doc.copytodatabase(copyDb)

newdoc.form = “Employee”

Subject: Database has not been opened yet - LotusScript error

This error occurs when you try to use a NotesDatabase object in ways that require it to be “open,” and it is not open at that time. The IsOpen property will tell you whether the database is open. See the description of IsOpen for a list of properties that are available when the database is not open.

If you get the NotesDatabase handle from a NotesDBDirectory object or from NotesSession.AddressBooks, it is not open until you call the Open method on it. But if you get the object in another way, for instance using New NotesDatabase, the database is normally opened at the same time.

So, the cause of the problem is the line of code that creates the NotesDatabase object. However, the error doesn’t occur until later on, when you try to use the object in a way that requires it to be open.

Dim dbLookup As New NotesDatabase(dbThis.Server, “resc\lookup.nsf”) ’ problem here: database doesn’t exist.

Set view = dbLookup.GetView(“Keywords”) ’ error occurs here.

Possible causes of the problem are:

There is no such database at the path you specified.

The ID running the code doesn’t have access to open the database.

The database file is damaged somehow and can’t be opened.

Use the LotusScript debugger, or insert some debugging output statements, to see the exact values of the strings you’re passing as arguments. Make sure they have the values you expect. If the values are correct, try to open the application manually, from the Notes client menus, using the exact same server name, filepath and Notes userID as was used by the code. The resulting error message should tell the cause of the failure.

Subject: RE: Database has not been opened yet - LotusScript error

i could not get you,suggest what should i do,it will be very handy for me.

Subject: RE: Database has not been opened yet - LotusScript error

Use the debugger, read the documentation.

Subject: Database has not been open yet

Hi Frnd,

       Use the following code it will definitely solve your issue. Paste the following code on the Button's Click.....

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim sourceDoc As NotesDocument

Dim destinationDoc As NotesDocument



Dim sourceDatabase As New NotesDatabase("DOMDEV","navneet\source.nsf")

Dim destinationDatabase As New NotesDatabase("DOMDEV","navneet\destination.nsf")



Set uidoc = workspace.CurrentDocument

Set sourceDoc=uidoc.Document

Set destinationDoc = sourceDoc.CopyToDatabase(destinationDatabase)

'Set newNotesDocument = notesDocument.CopyToDatabase( notesDatabase )



'You can edit the document and save it if you wish as you know have a handle to the newly created document.

'See other example

End Sub

Where DOMDEV is the given server name so you put there your’s server name there and the path of the given database for both source & destination database…ok

Subject: RE: Database has not been open yet

No, it won’t definitely solve his issue. Read Andre’s response for the likely causes of the problem.