Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    global DLookup function

    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?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: global DLookup function

    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. <img src=/S/headthrob.gif border=0 alt=headthrob width=15 height=15>
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: global DLookup function

    I beg to be apologized.I am so grateful for your previous replies and you did give me a chnace to solve
    some my problems with your wonrdeful advices
    May i wish you all the best

    Best regards

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: global DLookup function

    Could you point me to:

    discussion on building public functions

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: global DLookup function

    Look in this thread or do a search on public function.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •