Results 1 to 5 of 5
  1. #1
    queentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    3

    Unhappy Could someone help me please.... It's about access and word

    Hi everyone...
    For work I need to connect Access files to Word.
    I want to be able to type like the first letter of a name in a Word file (which I have on Access) and the rest automatically comes showing up in word.


    They're like clientfiles so that's the reason why I have to do it. It makes work a lot faster than now (typing all data myself).
    And I want it like saved so that every time I open that Word document I can do this again. So the wordfile will automatically have this.
    I hope someone knows what I mean because I'm desperate.
    Oh, before I forget we work with Word & Access 2010....

    Love, Q

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Youd have to do it the other way,
    in access, enter the name in a form, press enter,
    it would retrieve the name, click a 'word' button,
    this would send all the data to a word document.

    would this work for you?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    This code shows how to launch Ms Word from Ms Access.
    In a form that shows the record needed,
    put a button on the form header to launch the code
    the button reads text boxes on the selected record an puts them in word doc.

    user selects the record, then clicks the Word button,

    Code:
    Public Sub btnWord_click()
                        '*****  YOU MUST HAVE THE MS WORD XX.X OBJECT LIBRARY CHECKED in VBE menu, tools, references.  *****
    Dim objWord As Word.Application
    Dim doc As Word.Document
    Dim WordHeaderFooter As HeaderFooter
    
    Set objWord = CreateObject("Word.Application")
    
    With objWord
        .Visible = True
    
        Set doc = .Documents.Add
        'doc.SaveAs CurrentProject.Path & "\TestDoc.doc"
    End With
    
    With objWord.Selection
    
     .Font.Name = "Trebuchet MS"
     .Font.Size = 16
    
      .TypeText "Dear, " & txtName
      .TypeParagraph
      .TypeText "Address: " & txtAddr
      .TypeParagraph
      .TypeText "this note says you are in " & txtDept
    
        'Add header and footer
    
        ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "Header"
        ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = "Footer"
    End With
    
    'doc.Save
    doc.Activate
    
    Set objWord = Nothing
    End Sub

  4. #4
    queentje is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    3
    Sorry this really is the 2nd day I'm working with Access so.. I've already made a query of the data I need in word..
    So now I have to click on the 'title' of the column? and then on form? Sorry if I misunderstand (Dutch remember)

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    on the form header, put a button,
    in the property of the button, click event tab
    select the ON CLICK event,
    click the little ellipsis button that appears at far right
    click code builder
    put the code above in the button CLICK event
    alter my code to use YOUR text boxes. mine are txtName, txtAddr, txtDept

    put the REFERENCE in the app as well, in the menu bar, TOOLS, REFERENCES, check MS WORD XX.X OBJECT LIBRARY

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 08-13-2014, 10:32 PM
  2. Replies: 8
    Last Post: 04-14-2013, 01:33 PM
  3. Call word object and import word fields
    By silverspr in forum Programming
    Replies: 3
    Last Post: 12-10-2012, 11:32 PM
  4. Access to Word - Multiple Word Templates?
    By alpinegroove in forum Programming
    Replies: 11
    Last Post: 06-12-2012, 04:42 PM
  5. Access to Word
    By derohanes in forum Access
    Replies: 3
    Last Post: 08-26-2010, 08:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums