how do i specify which DB it connects to? i am opening an access file that has sql code in it and it automatically wants to connect to a specific file. how can i change this setting?
If you want to do this manually hold the shift key down and open the MDB. Then run the Linked Table Manager and choose a different MDB containing the tables you want. If Access 2003 see Tools >> Database Tools. If Access 2007 I think it's on a similar labelled item behind the Office button.
If you want to do this programmatically then see Relink Access tables from code http://www.mvps.org/access/tables/tbl0009.htm. I store the path and file name of the tables MDB, typically called the backend (BE) MDB, in an iNI file located in the same folder as the front end (FE) MDB. Although you could use the registry. This way when I release a new copy of the FE MDB/MDE it reads that path and file name and automatically relinks to the customers BE MDB.