• SQL Data to Word Field (Word 2000-2003)

    Author
    Topic
    #429146

    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!

    Viewing 1 reply thread
    Author
    Replies
    • #998670

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

      • #998676

        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!

      • #999133

        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,

        • #999152

          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.

    • #998698

      The best samples that I know of for learning how to do this are on Helen Feddema’s website, specifically the Access>>>Word section.

    Viewing 1 reply thread
    Reply To: SQL Data to Word Field (Word 2000-2003)

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

    Your information: