Newbie problems with GetFieldText

Posted on 2004-11-02
Last Modified: 2013-12-18
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?
Question by:GohdanTheMoblin
    LVL 24

    Accepted Solution

    Initialize event doesn't have the property of fields fully loaded..Run this script on PostOpen event.

    LVL 2

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
    IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now