Using DLookup in Libary Database 
Author Message
 Using DLookup in Libary Database

The DLookup function, when used in a library database, still tries to look
for the table (the domain) in the CurrentDB instead of the CodeDB.  How can
this be done?

Thanks!



Mon, 21 May 2001 03:00:00 GMT  
 Using DLookup in Libary Database
Hi,

I haven't tried it, but I would suggest replacing DLookup with a custom SQL
Select statement.

HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

Quote:

>The DLookup function, when used in a library database, still tries to look
>for the table (the domain) in the CurrentDB instead of the CodeDB.  How can
>this be done?

>Thanks!



Mon, 21 May 2001 03:00:00 GMT  
 Using DLookup in Libary Database
Use an explicit recordset, opened against CodeDB rather than CurrentDB.

HTH
Bill

Quote:

>The DLookup function, when used in a library database, still tries to look
>for the table (the domain) in the CurrentDB instead of the CodeDB.  How can
>this be done?

>Thanks!



Mon, 21 May 2001 03:00:00 GMT  
 Using DLookup in Libary Database
FWIW, here is the work around I came up with.  It's a custom DLookUp
function that accepts the same arguments as the DLookup, and merely creates
as recordset based off of CodeDB.  Here's the code if anyone is interested.

Public Function jmpCodeDBDLookup(strExp As String, strDomain As String,
Optional strCriteria As String) As Variant
'~~~Modified DLookup function to use within CodeDB only

    Dim db As Database
    Dim rs As Recordset

    Set db = CodeDb()
    Set rs = db.OpenRecordset(strDomain, dbOpenSnapshot)

    If Not IsMissing(strCriteria) Then
        rs.FindFirst strCriteria
    Else
        rs.MoveFirst
    End If

    If Not rs.NoMatch Then
        jmpCodeDBDLookup = rs.Fields(strExp)
    End If

    rs.Close
    Set rs = Nothing
    Set db = Nothing

End Function

Quote:

>The DLookup function, when used in a library database, still tries to look
>for the table (the domain) in the CurrentDB instead of the CodeDB.  How can
>this be done?

>Thanks!



Mon, 21 May 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Libary Database, MDEs & Future Upgrades

2. HELP me using Microsoft SQLOLE Object libary

3. HELP me using microsoft SQLOLE object libary

4. DLookup function used as criteria in query

5. Using DLookup with error 2471 resulting

6. Using the Dlookup function in code

7. Using DLOOKUP on a secured form

8. using a variable to specify field name in dlookup function

9. Using Dlookup in vba ?

10. V2.0 - Using DLookup when some fields are Null

11. The Dlookup function without using Access

12. Changing a report that uses 1 database into a report using 2 databases

 

 
Powered by phpBB® Forum Software