DLookup to another database (1 Viewer)

Chris Morris

Registered User.
Local time
Today, 21:52
Joined
May 3, 2011
Messages
20
We have a SQL Server back-end and about 30 Access front-end applications. We use one library file to handle common functions which is included in each of the front-end applications.

A problem I have is, sometimes in a library function I would like to make use of a DLookup which examines one of the tables, e.g.
Code:
DLookup("Filename","tblDocuments","Doc_ID = " & Me.Doc_ID
However when one of the front-end applications (e.g. Projects.accde) makes use of this function, it will try to find a the tblDocuments table within itself, not the library. I can fix the problem by ensuring the same table is linked to our SQL Server within the Projects.accde application, however this would be tiresome to check across all our applications, and I'm looking for something a bit more robust where the success of the function is not reliant on the Projects.accde application having that table.

Something along these lines perhaps (this doesn't work!):
Code:
DLookup("Filename","tblDocuments IN D:\Library\library.accde","Doc_ID = " & Me.Doc_ID
 

Minty

AWF VIP
Local time
Today, 21:52
Joined
Jul 26, 2013
Messages
10,368
There's no way of doing this but you can query a table in another database using a DSN connection and SQL query.
If you built a function to do this you could this you could simply call the function instead of your Dlookup...
 

Users who are viewing this thread

Top Bottom