Hey everyone,
So I have a materials database made up in mySQL, which holds linked tables for materials, manufacturers and vendors.
I also have a Bill of Materials (BOM) in excel, in which there are empty columns for manufacturers, vendors, etc.
The goal is to have a Macro button that, once pressed, it will populate the BOM's empty columns with the appropriate data from the database.
I have very little experience with VBA and macros, so the information I have gathered is all from forums and the web.
In VBA, I have created a module for the connection to the database.
After getting a few debug errors, I am now able to run it without any errors. Although when I click run, nothing really seems to happen, but I am assuming a connection is being made behind the scenes?![]()
Please Login or Register to view this content.
*Not sure if it's useful to mention at this point, I have already set up the ODBC driver and successfully tested the connection to the db, as well as added ActiveX Data Object 2.8 to Reference in VBA
Back in excel, I added a macro button to the BOM, and inserted the following code:
Although the code for the button does not do what I intend, it's mainly just to confirm that connections and whatnot are correct. Once I have confirmed that, I will work on the button code to do what I actually want it to..![]()
Please Login or Register to view this content.
I seem to be getting an error at the .ActiveConnection line and not sure why.
Was wondering if someone could let me know if I have the right idea/heading in the right direction, and possibly, what might be wrong with my code?
Thanks!
Bookmarks