Results 1 to 14 of 14
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    create word document (Access 2000)

    I want to create a word document called Notes in My Documents from Access.Could i do it with a code from Access?.

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

    Re: create word document (Access 2000)

    You can control Word from Access using VBA; this is called Automation. My fellow moderator <!profile=WendellB>WendellB<!/profile> has a short tutorial on Automation on his website: Automation 101. Creating a new Word document is one of the examples he gives. The tutorial contains links to other sources of information.

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: create word document (Access 2000)

    Thank you for your reply.I find the site you have recommended me great and there i did fnd the code.What i couldnt find is the following:
    Is it possible to open the word document called Notes in My Documents from within Access, write some notes and then save it.Then to
    open this same document from another place n Access, say another form, write further notes and then save agan.I didnt hear something
    of the kind up to now and i am curious about your opinion as a professional

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

    Re: create word document (Access 2000)

    Perhaps you can tell us why you want to do this, and what you want to accomplish.

  5. #5
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: create word document (Access 2000)

    i want to make notes about Thing ToDo while working in Access.In the database i am reading the information and the results of the
    actions and i want to write down the things to do in a word format.Also i want to sketch the contents of the mails i have to send also on the
    basis of the information i am reading in the database

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

    Re: create word document (Access 2000)

    I wouldn't use Automation for that, I would just keep the Word document open. You can easily switch back and forth using Alt+Tab or the Windows taskbar.

  7. #7
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: create word document (Access 2000)

    thanks.i wll follow your advice

  8. #8
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: create word document (Access 2000)

    is it possible to create a hyperlink to that word document,and is thee any code to that?

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

    Re: create word document (Access 2000)

    You don't need code for that.

    Put a label on a form, and set its caption (text) to Notes.
    Activate the Format tab of the Properties window.
    Click the ... button on the right hand side of the box.
    Locate and select the Word document, then click OK.
    When you switch to form view, you can click the label to open the Word document.

  10. #10
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: create word document (Access 2000)

    Thanks a lot.No need to use automation indeed.Thanks

  11. #11
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: create word document (Access 2000)

    following your advice i have succeeded with the label.When i open the word document Notes and write on it, if a close the document i am
    going out of the database.I have to use the back arrow on the toolbar to go back to the same place.My question is, is it possible to put some
    code or macro on the word document enabling to go back at the same place in Access ?

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

    Re: create word document (Access 2000)

    How do you mean "i am going out of the database"? When you open the Word document by clicking on the label, the Access database should remain open in the background.

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

    Re: create word document (Access 2000)

    This has happened to me as well.

    When you close the Word Doc focus is returned to Windows Desktop with the Access Application minimized giving the appearance that Access is closed. All you have to do is click the Access task bar bottom of screen to restore the App.

    I guess the question is, how do you keep Access from automatically minimizing?

    John

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

    Re: create word document (Access 2000)

    This happens for some users, not for others, and there doesn't really seem to be a way to change this behavior. As an alternative, you can use ShellExecute to open the Word doc. Put the following code at the top of a module:

    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Public Const SW_SHOWMAXIMIZED As Long = 3

    Use code like the following to open the document. Substitute the correct path and filename.

    Dim lngResult As Long

    lngResult = ShellExecute(hWndAccessApp, "Open", "C:WordMyDocument.doc", 0&, 0&, SW_SHOWMAXIMIZED)
    If lngResult <= 32 Then
    MsgBox "Couldn't open the document.", vbExclamation
    End If

    This code can be part of the On Click event procedure of a command button or label, for example.

Posting Permissions

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