Trying to redirect a database open to a new form

Hi all,

I am using a db script that I am adding to my Global Options in a view that opens when the database is launched.

I want to check the username against a list stored in a Profile document and if there is a match then stop opening the view (actually a frameset) and redirect the user to a form for further processing.

Here is a basic example of my current code:

Sub Initialize

Dim ws As New NotesUIWorkspace



Dim uidoc As NotesUIDocument

Dim session As New NotesSession



Dim db As NotesDatabase

Dim profdoc As NotesDocument



Dim dbFile As String

Dim UNme As String

Dim dbSrv As String



Dim NmeList As Variant



Set db = session.CurrentDatabase

dbFile = db.FileName

dbSrv = db.Server



UNme = session.CommonUserName



Set profdoc = db.GetProfileDocument("GUProfile")



NmeList = profdoc.GUList



Forall x In NmeList

	

	If UNme = x Then

		Set uidoc = ws.ComposeDocument(dbSrv, dbFile, "LaunchForm")

		Exit Sub

	End If

		

End Forall

End Sub

Currently, I get a Server Error - File does not exist AND Unable to find document window.

I suppose at this point in time (when launching the database) there is no UI to access.

Any clues on where to go would be greatly appreciated.

Cheers,

Mark

Subject: Trying to redirect a database open to a new form

should it be “filepath” instead of “filename”

Subject: RE: Trying to redirect a database open to a new form

You are correct… thanks for catching this… that solves the first problem…

Unfortunately now the database launches both the Frameset and the new document (Form).

How can I stop the frameset from opening?

Thanks again for any and all comments.

Mark

Subject: double post

double post

Subject: I did something similar

I wanted to do something similar. I check whether the current user has an Author Setup document. If not, I open a messagebox and ask him if he wants to create one. If so, I open a dialogbox containing the Author Setup form for him to complete. The script is in the database’s Postopen event.

Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase , asdoc As NotesDocument

Set db = session.CurrentDatabase

abbrvname = Evaluate ( { @Name( [Abbreviate] ; “} & session.UserName & {” ) } )

If db.GetView ( “AuthorProfiles”).GetDocumentByKey ( abbrvname ( 0 ) , True ) Is Nothing Then

…If Msgbox (“Your Author Setup was not found. Create it now?” , 32+4 , “Error” ) = 6 Then

…Set asdoc = db.CreateDocument

…apdoc.Form = “AuthorSetup”

…dboxflag = workspace.Dialogbox ( “dboxAuthorSetup” , True , True , True , False , False , False , “New Author Setup” , asdoc )

…End If

End If