Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

Newbie problems with GetFieldText

I just started Notes development and I'm having a few problems.  I am trying to read the value of a field when the document is opened, but I can't understand why I am getting an error.  In a form's Initialize event I am using the code:

      Messagebox "Initializing Form"
      Dim workspace As New NotesUIWorkspace
      Dim doc As NotesUIDocument
      Set      doc = workspace.CurrentDocument
      Dim txtMessage As String
      txtMessage = doc.FieldGetText("NumberField")
      Messagebox "The document is " & txtMessage

And I get the error "Notes error - cannot locate field".  The field is in the form, so I can't figure out why Notes cannot locate it.  Do the fields not exist in the Initialize sub?  When I place the same code in the field's Initialize sub, I get "Object variable not set" because Doc is nothing, but in the form's Initialize sub Doc is set to the new document.

Can someone explain what is going on to me?
1 Solution
Initialize event doesn't have the property of fields fully loaded..Run this script on PostOpen event.

GohdanTheMoblinAuthor Commented:
Thanks, I figured it was something stupid.  I really need to find a good book.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now