• mail merge with database field, data formatting (O

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » mail merge with database field, data formatting (O

    Author
    Topic
    #423287

    Hello loungers
    I am mail merging with a database field containing a SQL statement enabling a one to many result.

    The problem occurs with the financial data …
    this is displayed to a gazillion decimal places, 2 would suffice.

    If I was merging normally I would format the merge field with a picture switch.

    Has anyone got a solution to formatting the results within a database field.

    Thanks in advance.

    Geof

    Viewing 0 reply threads
    Author
    Replies
    • #968126

      In the SQL query are you able to modify the field to round the output eg Result_: Round([Result],2)

      • #968128

        Thanks for the reply Andrew,
        Alas no.
        Even rounding the fractional component doesnt help.

        Truncating the remainder with left() doesnt help.
        Word pads the result with trailing zeroes in the merge result
        Cheers
        Geof

        • #968138

          Can you provide some information about the SQL statement, in particular about the field you’re having problems with?

          • #968144

            Hello Hans
            The contents of the field follow

            Database d “F:DataCustomersTDCrates_remits.mdb” c “Provider=Microsoft.Jet.OLEDB.4.0;Password =””,s “SELECT remits.TRANS_DATE, remits.PAYMENT, remits.GST_CONTENT
            FROM remits INNER JOIN residents ON remits.RID_ID = residents.RID_ID WHERE <>” h

            The problem is similar to that experienced with mail merging from excel data sources that surfaces with office 02 I think. These I resolve easily enough.

            I guess I am going to perform the merge differently.

            Regards and thanks for your interest.

            Geof

            • #968145

              Have you tried adding a number format switch to the merge field in Word?
              – Right-click the relevant merge field.
              – Select Toggle Field Codes from the popup menu.
              – Make it look like this (where PAYMENT is the name of the merge field):

              { MERGEFIELD PAYMENT # "0.00" }
              

              – Press F9 to toggle field codes off and to update the result.

              Note: The brackets { } have been created by Word, don’t type them yourself or try to overtype them.

            • #968148

              Hello Hans

              The problem is that these columns are returned as part of a table as a result of the database field.

              They are not discrete mergefields, I dont think you can add a number format switch to the database (table) field.
              Cheers

              Geof

            • #968149

              Sorry, should have seen that. Not enough coffee yet this morning.

              You wrote that using Round didn’t work; have you tried using Format? For example

              SELECT remits.TRANS_DATE, Format(remits.PAYMENT, “0.00”) , …

            • #968164

              Hello Hans

              I cant make format command work in this context. Error reports ‘unable to open database …’
              Interesting to note though that use of

              format(fieldname, “0.00”)

              within an MS Access query designer is translated to use FIXED in the sql statement.

              I guess I will do the job from Access as a report.

              Cheers and thanks again for the efforts.

              Geof

    Viewing 0 reply threads
    Reply To: mail merge with database field, data formatting (O

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

    Your information: