Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating Word Doc from Access (Win2K/Office2K)

    Hi

    I'm in the process of writing a sales database, and constructing the Word Doc that will become the Invoice.

    I've got it all working using DocProperty etc. BUT

    When a new row is added in the items table in the invoice, the cells are always show with the bottom border. Is there a way of having this border invisible like the other three sides??

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating Word Doc from Access (Win2K/Office2K)

    If you are adding the new row using Selection.MoveRight wdTab (starting from the last cell in the previous row), the new row will have the same border properties as the one above it. Let's assume that you have an insertion point in the first cell in the new row, you can turn off the borders for that row using a little VBA:
    <pre>Sub ClearBottomBorderFromCurrentRow()
    Dim cell As Word.cell
    For Each cell In Selection.Rows(1).Cells
    cell.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    Next
    If Not (cell Is Nothing) Then Set cell = Nothing
    End Sub
    </pre>

    If you are not working with the selection, then there are other possibilities. Does this help?

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Word Doc from Access (Win2K/Office2K)

    Thanks!! Doh!!

    "the new row will have the same border properties as the one above it" did it! Can't believe i didn't see that!!

    OK, one other problem that is driving me completely nuts......

    I am filling in various docproperty fields with great success.. EXCEPT

    3 fields showing invoice subtotal, freight and total.

    They are debug.print fine in my Access code, but when they are inserted into my Word doc they are being rounded up!!

    E.G.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating Word Doc from Access (Win2K/Office2K)

    Does the document property show the correct value in the File>Properties....>Custom dialog? If so, I would suspect some kind of number formatting switch in your DOCPROPERTY field. If you click in it and press Shift+F9, the answer may be revealed. If not, then there may be something odd about either your code or the way the property is defined.

  5. #5
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Word Doc from Access (Win2K/Office2K)

    OK, to answer your first question, no it is not correct in the doc's properties. It is the rounded up figure as displayed in the field.

    Other info. that might help:

    The code in the field: {DOCPROPERTY "Subtotal" #

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating Word Doc from Access (Win2K/Office2K)

    <P ID="edit" class=small>(Edited by jscher2000 on 25-Oct-04 19:02. Doesn't work as I thought it might.)</P>Ah, yes, I remember now. If a numeric property is initially created as an integer (e.g., added with a nondecimal value), then any decimal value assigned to the property will be rounded. What is your code for creating the property in the first place?

    Added: Here the old thread I remembered: Wayward custom document property. The workaround is to pre-create the document property interactively with a decimal place. In testing with Word 2002, I can't seem to create a decimal numeric property with VBA. The other option is to store it as a string property.

  7. #7
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    Barnsley, Yorkshire, England
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Word Doc from Access (Win2K/Office2K)

    Thanks, you're a star!! And my PC is still in one piece - though it was getting close, lol...

    So its a bug, or at the very least a very poorly documented feature....

Posting Permissions

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