Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Posts
    43

    Angry Unanswered: Headache with Dlookup

    I’m using a dlookup as control source for a textbox on a report (‘myreport’).
    The dlookup is supposed to look up a field on the report (field ‘OrganisationID’) and return the OrganisationName from a table called (‘Organisation’).

    I used this code as control source;

    =DLookup("OrganisationName", "Organisation", "OrganisationID=" & Reports![Myreport]!OrganisationID)

    But keep on getting errors such as operator, opersand missing ! Whatever I try I can’t get it to work.
    Could anyone have a look !!

    Thanks in advance !

    Chiron

  2. #2
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Re: Headache with Dlookup

    Originally posted by Chiron
    I’m using a dlookup as control source for a textbox on a report (‘myreport’).
    The dlookup is supposed to look up a field on the report (field ‘OrganisationID’) and return the OrganisationName from a table called (‘Organisation’).

    I used this code as control source;

    =DLookup("OrganisationName", "Organisation", "OrganisationID=" & Reports![Myreport]!OrganisationID)

    But keep on getting errors such as operator, opersand missing ! Whatever I try I can’t get it to work.
    Could anyone have a look !!

    Thanks in advance !

    Chiron
    try this:
    =DLookup("OrganisationName", "Organisation", "OrganisationID = " & Report_Myreport.OrganisationID & "")

    if organisationID isn't numeric then:

    =DLookup("OrganisationName", "Organisation", "OrganisationID = '" & Report_Myreport.OrganisationID & "'")

  3. #3
    Join Date
    Nov 2003
    Posts
    43
    Thks for the help actionant !! But it doesn't like any of them either !!

    I still get the error message : "you omitted an operator or operand, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks"

  4. #4
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178
    Originally posted by Chiron
    Thks for the help actionant !! But it doesn't like any of them either !!

    I still get the error message : "you omitted an operator or operand, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks"
    what about if you add
    .value
    after organisationid

  5. #5
    Join Date
    Nov 2003
    Posts
    43

    Unhappy

    Doesn't work either !! But thanks for trying ! BTW OrganisationID is indeed a numeric field.

  6. #6
    Join Date
    Nov 2003
    Posts
    43
    Got it !! I changed the comma by a ; and it all works fine. Thx for the help actionant !!


    =DLookup("OrganisationName";"Organisation";"Organi sationID = '" & Report_Myreport.OrganisationID & "'")

Posting Permissions

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