• global DLookup function

    Author
    Topic
    #357155

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #530059

      Didn’t we just have a similar discussion on building public functions? The principles are exactly the same, so you need to get a little practice applying them. headthrob

    Viewing 0 reply threads
    Reply To: global DLookup function

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: