Hello all,
I have an Access '97 database that has a number of tables in it linked to SQL Server via ODBC (don't ask why - let's just say I'm trying to maintain someone else's crappy system!!)
In Access, whenever you go to look in one of these linked tables it pops up the Connection dialog box - eg enter the USERNAME, PASSWORD, SERVER etc. This information is already filled in so all you have to do is hit OK.
Right - with me so far? Good.
I am now trying to access this database from within VB using the Access.Application object. I need to open the database and run a macro. This I can do. The problem is when I run the macro Access pops up the Connection dialog box as above (because the macro refers to one of the linked tables). How can I tell Access using the Application object to connect to the appropriate ODBC before I ask it to run the macro so that this dialog box doesn't appear?
I've tried the Access.Application.CurrentDB.Connect property but it doesn't work.
Any ideas?


Reply With Quote