DLookup function valid for all forms and reports
How can i make a DLookup function be valid for all forms and reports
and not tied up with a given order or report? I have to refer to each report and form where
i use it.
For example, for the report called Profitability, i use the following DLLokup code :
Dim duty As Variant
Dim pct As Variant
pct = DLookup(“duty”, “Categories”, “CategoryID = ” & Reports![Profitability]!categoryid)
If i use in a code refering to the form Products, then again i must use the following code
Dim duty As Variant
Dim pct As Variant
pct = DLookup(“duty”, “Categories”, “CategoryID = ” & Forms![Products]!categoryid)
Is it possible to create a generic code looking up the table “Categories” and to be eased in each
form and report?