Too Many Keys Error

I have a view that has the first 2 columns sorted.

When a user presses the save button on a document I have the following code:

Dim keys(1 To 2) As String

keys( 1 ) = Source.FieldGetText("RECIPIENT")

keys( 2 ) = Source.FieldGetText("LAYOUT")



	Set view = db.GetView ("FEM200PC" )

	

Set doc = view.GetDocumentByKey (keys,True)

.

.

.

.

I do this to make sure that a record with the same key does not exist.

This worked fine.


I then had a request to make the socond column sortable by the user.

When the user sorts the view then double clicks on a document and tries to save a doc.

The above code generates a ‘Too Many Keys’ error, since now the first column is unsorted.

If he then goes to the view and unsorts the view and tries again he does not get the error.

I tried adding code:

Set column = view.Columns( 0 )

	If Not column.IsSorted Then

		column.IsSorted = True

	End If

	Set column = view.Columns( 1 )

	If Not column.IsSorted Then

		column.IsSorted = True

	End If

	Call view.Refresh

Which I thought would resort the columns, but that does not help.

Any ideas on how to prevent the ‘too many keys’ error?

Thanks

Subject: Try always using hidden views for programability.

It never breaks your code when the “User” wants something changed.

Subject: RE: Try always using hidden views for programability.

I am dealing with virtual documsnts. I have an outstading issue with virtual documents. If I have 2 views for the same form, go to one view and delete a document, it still exisits in the second view until I rebuild it. I there for have to set the view to rebuild each time in the view properties. This slows down the application.

I am therefore trying to solve this issue without adding another view.

Thanks

Subject: @Formula?

What happens if your second “lookup” view has only one sorted column, RECIPIENT + LAYOUT, and you use a validation formula with a @DbLookup(“”:“NoCache”;…) on that view to check for duplicates?

Subject: Are you saying that NotesView.Refresh does not work and you still get the deleted doc in the view?

Subject: RE: Are you saying that NotesView.Refresh does not work and you still get the deleted doc in the view?

http://www-10.lotus.com/ldd/eiforum.nsf/DateAllThreadedweb/7a1457f63e00272085256ec400541cac?OpenDocument

Thanks