Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word Automation Missing Field Problem? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I am printing the current record on a form to Word 2000 with automation

    The following code works OK if there is a value in all 4 fields however if middle name or suffix is missing Partner1 in the Word document is blank

    What do I have to change in the following code to print Partner1 is there is a missing field?

    <pre>.ActiveDocument.Bookmarks("Partner1").Selec t
    .Selection.Text = (CStr(Forms!frm_POS_DomesticPartnership!strFirstNa me)) & " " & _
    (CStr(Forms!frm_POS_DomesticPartnership!strMiddleN ame)) & " " & _
    (CStr(Forms!frm_POS_DomesticPartnership!strLastNam e)) & " " & _
    (CStr(Forms!frm_POS_DomesticPartnership!strSuffix) )
    </pre>


    Thanks, John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Automation Missing Field Problem? (a2k (9.0.6926) SP-3 Jet 4.0 SP

    Do you have an On Error Resume Next somewhere in there? CStr will fail if you supply it a null value. Why do you use CStr anyway? I assume that strFirstName etc. are text fields. so no conversion should be needed.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Automation Missing Field Problem? (a2k (9.0.6926) SP-3 Jet 4.0 SP

    Was just using the following code, there was an on error resume, I remove CStr and all is OK

    Thanks, John


    How to send the current record to Word 2000 with automation
    http://support.microsoft.com/kb/210271/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •