Results 1 to 9 of 9

Thread: Dlookup problem

  1. #1
    Join Date
    Jan 2004
    Posts
    100

    Unanswered: Dlookup problem

    A prior problem I had has morphed into a dlookup problem....

    It seems I am having trouble with the syntax for the criteria portion of the Dlookup command. I want to compare the value of the field called pr_ppProjectId found in the query called EMRevenueForecast to a field called pr_ppProjectId found in the table called Forecasts (this table is the form's record source) and present a value called pr_ppClientName from the same query.

    This is one of the many iterations I've tried:

    =DLookUp("pr_ppClientName","EMRevenueForecast","[EMRevenueForecast]![pr_ppProjectId]=" & [pr_ppProjectID])

    Thanks!

    Norm

  2. #2
    Join Date
    Jan 2004
    Posts
    26

    Re: Dlookup problem

    What is the error you are getting?
    Also, try this:

    =DLookUp("pr_ppClientName","EMRevenueForecast","[pr_ppProjectId]=" & [pr_ppProjectID])

    It doesn't look like it should be, but is pr_ppProjectID a string? If so, try this:
    =DLookUp("pr_ppClientName","EMRevenueForecast","[pr_ppProjectId]=""" & [pr_ppProjectID] & """")


    Let me know if that helps,
    Scott

  3. #3
    Join Date
    Jan 2004
    Posts
    100

    Re: Dlookup problem

    Originally posted by Balinor
    What is the error you are getting?
    Also, try this:

    =DLookUp("pr_ppClientName","EMRevenueForecast","[pr_ppProjectId]=" & [pr_ppProjectID])

    It doesn't look like it should be, but is pr_ppProjectID a string? If so, try this:
    =DLookUp("pr_ppClientName","EMRevenueForecast","[pr_ppProjectId]=""" & [pr_ppProjectID] & """")


    Let me know if that helps,
    Scott
    The error I get is #Error.

    The pr_ppProjectID is a string so I tried your string solution but still get the #Error.

  4. #4
    Join Date
    Jan 2004
    Posts
    26
    Is this dlookup in a form, query, or report?

    Try this one:
    =DLookUp("pr_ppClientName","EMRevenueForecast","[pr_ppProjectId]='" & [pr_ppProjectID] & "'")

    Also, just for kicks and giggle, try removing the = at the beginning

    Let me know,

    Scott

  5. #5
    Join Date
    Jan 2004
    Posts
    100
    Originally posted by Balinor
    Is this dlookup in a form, query, or report?

    Try this one:
    =DLookUp("pr_ppClientName","EMRevenueForecast","[pr_ppProjectId]='" & [pr_ppProjectID] & "'")

    Also, just for kicks and giggle, try removing the = at the beginning

    Let me know,

    Scott
    The dlookup is in a form. The form refers to both a query (for screening purposes) and a table (for editing purposes). The table is the record source for the form so the user can edit directly to the table.

    The first solution gets me the #Error and removing the '=' gets me #Name?.

  6. #6
    Join Date
    Jan 2004
    Posts
    26
    Do you have an actual control (text box) on your form named[pr_ppProjectID]?

    If not you will need to create it.

    Let me know,

    Scott

  7. #7
    Join Date
    Jan 2004
    Posts
    100
    Originally posted by Balinor
    Do you have an actual control (text box) on your form named[pr_ppProjectID]?

    If not you will need to create it.

    Let me know,

    Scott
    I've created a test database that highlights the problem. Run the form when you open it to see what I'm trying to do.

    Thanks,

    Norm
    Attached Files Attached Files

  8. #8
    Join Date
    Jan 2004
    Posts
    26
    Found the problem:

    =DLookUp("pr_ppClientName","qryEMRevenueForecast", "[pr_ppProjectId]='" & [pr_ppProjectID] & "'")

  9. #9
    Join Date
    Jan 2004
    Posts
    100
    Originally posted by Balinor
    Found the problem:

    =DLookUp("pr_ppClientName","qryEMRevenueForecast", "[pr_ppProjectId]='" & [pr_ppProjectID] & "'")
    It works! Thanks so much for the help.


    Two looooong days trying to figure out this problem! Thanks again.
    Last edited by norm801; 02-12-04 at 17:17.

Posting Permissions

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