var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: dlookup to an outside DB
I'm trying to do a DLookup on a table that I've opened in an outside DB...any ideas...
Here's my first effort....thanks in advance...
Private Sub Command6_Click()
Dim dbConn As ADODB.Connection
Dim tcTbl As ADODB.Recordset
Dim varID As Variant
Dim varPW As Variant
Set dbConn = New ADODB.Connection
dbConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=\\Bronx1\Common2\Dispatch\Db\Scrub\Scrub_BE .mdb"
dbConn.Properties("Jet OLEDB:Max Buffer Size") = 256
Set tcTbl = New Recordset
tcTbl.Open "DispID", dbConn, adOpenForwardOnly, adLockOptimistic
varPW = DLookup("[PW]", "dbConn!DispID", " [DispatchID] = '" & Forms!LogIn!DispID & "'")
Create a linked table and then use it like it's an internal table. After that, you can take the table as a DAO.TableDef object and change it's properties if you want to use code to link to a different table in a different database.
You know how to create a connection and a recordset, so why bother with a slow DLookup? Why not use the Find method of the recordset?
All you would have to do is add:
If DispatchID is indexed this should be far faster. Assuming there are more than a handful of records.
tcTbl.Find "[DispatchID] = '" & Forms!LogIn!DispID & "'"
if not tcTBL.EOF then
its great to learn new things everyday...