Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Word 2003 VB Connection to Database

  • 18-12-2008 5:12pm
    #1
    Registered Users, Registered Users 2 Posts: 63 ✭✭


    trying to connect to a sql server or a syabse database using a macro created in word 2003. when i press a button i want it to run a query from the database and return the results to a textbox or listbox. anyone have any sample code to do this?


Comments

  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    You don't say what database you are using.

    But theres a few ways of doing it. Create a VBA project, add a data reference to it, then code the connection. Thats the only way I've done it. However there are other ways for example using the data connection wizards.

    http://dev.mysql.com/doc/refman/5.1/en/connector-odbc-examples-tools-with-wordexcel.html

    I'm not that familiar with those as I hardly ever use them. I have also just dumped lookup files, in XML, txt formats out of the database on a scheduled job, for excel or word vba applications to pick them up.


Advertisement