Re-Assign A Database

Hi guys,

I have some lotusscript that loops through a list of names, finds their mail server and mail file from their NAB record, opens their mailfile, then does some stuff.

I have a problem with more than 1 user though.

The first users mailfile always opens, however next name in the list causes error:

Error 4296: This database object is already open as [SERVERNAME]!!mail[MAILFILE] on line 65.

So I’ve tried at the bottom of the loop to Set userMailFile = Nothing, but then I get the error:

Error 91: Object variable not set on line 65.

I was hoping that by setting the database object to nothing, I could then re-assign it?

The code FYI on line 65 is simply:

Call userMailFile.Open(mailServer,mailFile)

Does anyone have any tips how I can re-use my mailfile object multiple times in my loop?

Thanks

Subject: Resolved

Just an FYI for anyone with a similar issue, Ive got around this.

Instead of dimming the db as New NotesDatabase I have dimmed As NotesDatabase.

'Dim userMailFile As New NotesDatabase(“”,“”) OLD CODE

Dim userMailFile As NotesDatabase NEW CODE

Then in my loop, instead of using the open method, I am setting the database instead.

'Call userMailFile.Open(mailServer,mailFile) OLD CODE

Set userMailFile = New NotesDatabase(mailServer,mailFile) NEW CODE

This now allows me to use the database object multiple times, pointing to different databases each time within my loop.

I have kept the line: Set userMailFile = Nothing at the bottom of the loop.

Not sure if its needed as haven’t tried testing with it removed yet.

Cheers