Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    SQL Data to Word Field (Word 2000-2003)

    I need to insert data from an SQL server database into a Word document (user may be using version 2000 or higher). We do not want to use mail merge because we are inserting the data into the open document, not creating multiple documents. I'm thinking that we would just set up a form and when the user tabbed to the field, it would be filled with the information from the database using an entry macro. I have no experience with this type of macro and have no idea where to begin. I want to start with just 1 field for practice. Here is the datbase information:

    Server: (local)
    Database: RemoteMT
    Table: ActivityJobQueue
    Column: JobID
    Row: 1

    I would love a sample macro or to be pointed to some other documentation that would help me.

    Thank you!

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

    Re: SQL Data to Word Field (Word 2000-2003)

    You can use the Database field:
    - Select Insert | Field...
    - Select the Database field, then follow the instructions.

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: SQL Data to Word Field (Word 2000-2003)

    Thanks Hans, after a little more research, I guess I am going to have to improve my programming skills and create a UserForm to do the job. Once I make a little progress, I will probably be posting more about this project!

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: SQL Data to Word Field (Word 2000-2003)

    The best samples that I know of for learning how to do this are on Helen Feddema's website, specifically the Access>>>Word section.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Park City, Utah
    Posts
    189
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: SQL Data to Word Field (Word 2000-2003)

    I'm back to wanting to learn how to use Database fields. The database information is:

    Path: C:Program FilesMicrosoft SQL ServerMSSQLData
    Server: (local)
    Database: RemoteMT
    Table: ActivityJobQueue
    Column: JobID
    Record: 1

    I am still a bit confused about how to use some of the switches. I just want to insert 1 piece of information from the database, the JobID, so here is what I have by database field switches:

    b (not used)

    c (I have no idea what to put here. I am connecting to the database referred to in the first post.)

    d (not needed because I am connecting to a SQL database)

    f "1" (I only need the data from the first record)

    h (not used)

    l (not used)

    o (not used)

    s "select "JobID" from "ActivityJobQueue"" (It has been so long since I used queries, I have no idea if this will work.)

    t "1" (start number and end number are 1 because I only want the data from record 1)

    In summary I need help with the c (connect) switch and also to know if the other switches are correct.

    Thanks,

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

    Re: SQL Data to Word Field (Word 2000-2003)

    If you click the Insert Database... button in the Insert | Field dialog after selecting Database, you should be guided through the process of connecting to SQL server etc. That way, you won't have to write the field switches yourself.
    Attached Images Attached Images
    • File Type: png x.PNG (6.8 KB, 2 views)

Posting Permissions

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