Programatically changing the table that DLOOKUP Uses

chrisbrookeanna

Registered User.
Local time
Today, 22:26
Joined
Apr 6, 2004
Messages
14
Hi,

In the DLOOKUP function you specify the table name as a string. How can substitute this string for a variable, that I can set programatically to search different tables. Also for the field names?

Thanks.
 
Is it a secret ? - or can you share it
David b
 
First create a function:
Function PersTimely(ByVal SFID As String, ByVal sDATE As String, ByVal eDate As String)
PersTimely = DCount("TRANSACTION", "MASTERDTL", "ET < " & 10 & " AND STATUS <> '" & "Reject' AND " & "TRANSACTION LIKE '" & SFID & "*' AND POSTDT BETWEEN #" & sDATE & "# AND #" & eDate & "#")
End Function

Then call the function passing values:
bTimely.Value = PersTimely("SG", mFM, mTo)
 

Users who are viewing this thread

Back
Top Bottom