Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Aug 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DLookup function (Access 2000)

    In the ControlSource of a text box in a report i have tried the following DLookup function:

    '=DLookup("grade", "OutVa", "productid = " & productid)

    With the above function i wanted to pull the field "grade" from the query "OutVa" having the same ProductID number.The productID number exists both in the query and the report.
    However on opening the report i receive the message "Enter parameter value"
    Can somebody help me ?

  2. #2
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: DLookup function (Access 2000)

    I'd recommend enclosing field names in brackets to avoid confusion:
    <pre>=DLookup("[grade]","OutVa","[productid]=" & [productid])</pre>

    This should work, assuming nothing is misspelled & ProductID is a numerical value.

    HTH

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DLookup function (Access 2000)

    I have found Access sometimes gets upset if you have a call like this and you have a control name the same as the underlying field name. Also with reports it really likes the field to be on the report (hidden if you don't want a user to see it). In other words make certain your ProductID is in a bound control on the report called eg. ctlProductID.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: DLookup function (Access 2000)

    Normally this message means that you have not spelled something correctly in the query.
    Have you tried to run the query Outva standalone? Do you get the same error when you run it standalone?
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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