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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Word Automation Missing Field Problem? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    • This topic has 2 replies, 2 voices, and was last updated 18 years ago.
    Author
    Topic
    #442374

    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?

    .ActiveDocument.Bookmarks("Partner1").Select
    .Selection.Text = (CStr(Forms!frm_POS_DomesticPartnership!strFirstName)) & " " & _
                              (CStr(Forms!frm_POS_DomesticPartnership!strMiddleName)) & " " & _
                              (CStr(Forms!frm_POS_DomesticPartnership!strLastName)) & " " & _
                              (CStr(Forms!frm_POS_DomesticPartnership!strSuffix))
    

    Thanks, John

    Viewing 0 reply threads
    Author
    Replies
    • #1064716

      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.

    Viewing 0 reply threads
    Reply To: Word Automation Missing Field Problem? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: