Code from IBM site for rt validation not working correctly?

Hi All,

I wonder why the code below is not working. The only change I made was to rename “rtfield” to the richtext field on my form, “LinkField”. I keep getting a “Type mismatch in method AssignClassIntance…error…”, then it saves and closes the document. I got the code from here,

Our third method validates a rich text field in which an input consisting solely of an attachment, embedded object, or link is allowed, even if it includes no accompanying text. Once again, we use the Querysave event of the form containing the field:

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim rtitem As NotesRichTextItem

Set doc = Source.Document

Set rtitem = doc.GetFirstItem( "rtfield" )

Dim text As String



text$ = Source.FieldGetText("rtfield")

trimmed$ = Trim(text)



If(doc.Hasembedded)  Then

	Continue = True

			

Elseif ( trimmed$ = "") Then

	Msgbox "Please enter some text."

	Continue = False

	source.GotoField("rtfield")

	source.Refresh(True)

Else

	Continue = True



        End If

End Sub

Thanks

Subject: Code from IBM site for rt validation not working correctly?

First of all, show your code.Second, run the code in the debugger and tell us what line the error happens on, and what the value is for all relevant variables/objects.

Also, unless your validation involves the presence of attachments, you don’t need all that code.

Why don’t you describe what kind of validation you are trying to do, it will be much easier to come up with a solution then.

The IBM page you link to also says: “We assume that you have some experience developing applications using Domino Designer and LotusScript.”

You should never copy/paste code you don’t understand what it is doing.

Subject: RE: Code from IBM site for rt validation not working correctly?

Thank you. I do know what I am trying to achieve. Trying to validate a rt field for doclink. I have it working now.

Subject: If you have it working now…

… then why don’t you share the code for your solution?

People have been helping you by answering your questions here. Now you have a chance to help other people.

-rich

Subject: RE: Code from IBM site for rt validation not working correctly?

You should explain in your initial (first) message what it is you are trying to do. It does not help us just becaus eYOU know what you are trying to do.

I would recommend that you take a look at this documentation, it is very helpful: How To Ask Questions The Smart Way

Subject: RE: Code from IBM site for rt validation not working correctly?

Rich point very well taken. Will do. Karl you come across as rude and being insulting. I don’t need your lecture. The questions are never clear to you. That’s fine. Please when you see my posts just skip them.

Subject: RE: Code from IBM site for rt validation not working correctly?

Karl is trying to help you. If you follow his advice, it’s much easier for others to help you. You have people here who are helping others for no gain, purely out of good will.

Subject: RE: Code from IBM site for rt validation not working correctly?

Ok thanks, point taken. Have a good one everyone.

Subject: RE: Code from IBM site for rt validation not working correctly?

Wish they had a like button. We are not here to guess what was tried but to help guide in the right direction.

Subject: RE: Code from IBM site for rt validation not working correctly?

Thanks Carl. I remember you helping me.