another Dlookup problem...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vkong85
    New Member
    • Jun 2007
    • 24

    another Dlookup problem...

    I'm creating a database for work and i've run into a snag. Currently i'm using to nested dlookup statements and they are searching for certain criteria in order to find the correct value the statement reads:

    = DLookup ( "[tbl Cost Center]![Description]" ," tbl Cost Center", "[tbl Cost Center]![CC]= DLookUp("[tbl People]![CC]","tbl people","[tbl People]![EmployeeNumber]= Forms![Requests]![cmbRequestor]")")

    i've swapped the quotations marks and have tried god knows how many syntaxs for numeric and text. The first dlookup criteria is text. the second dlookup criteria is numeric. I've exhausted everything i know how to do.

    The error message is as follows:

    "...Databas e can't parse the expression..."
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    =DLookup("[Description]" ,"[tbl Cost Center]", "[CC]=" & DLookUp("[CC]","[tbl people]","[EmployeeNumber]=[Forms]![Requests]![cmbRequestor]"))

    Comment

    • vkong85
      New Member
      • Jun 2007
      • 24

      #3
      "...syntax error (missing operator) in query expression '[CC]='..."

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Originally posted by vkong85
        "...syntax error (missing operator) in query expression '[tbl cost center]![CC]='..."
        CC is a text value?

        Code:
        =DLookup("[Description]" ,"[tbl Cost Center]", "[CC]='" & DLookUp("[CC]","[tbl people]","[EmployeeNumber]=[Forms]![Requests]![cmbRequestor]") & "'")

        Comment

        • vkong85
          New Member
          • Jun 2007
          • 24

          #5
          yes cc is a text value in the cost center database

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Okay, then use the new code I provided.

            Comment

            • vkong85
              New Member
              • Jun 2007
              • 24

              #7
              says that action failed... no error message provided...

              action failed:
              macro name: SetDept
              Condition: True
              Action name: Setvalue
              Arguments:.....

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                Originally posted by vkong85
                says that action failed... no error message provided...

                action failed:
                macro name: SetDept
                Condition: True
                Action name: Setvalue
                Arguments:.....
                You're trying to do this through a macro? I was not aware of that. I thought you were just using it as the control source of a textbox.

                Comment

                • vkong85
                  New Member
                  • Jun 2007
                  • 24

                  #9
                  yes im doing it through expression builder under the 'build event' option...

                  is there another way to populate the field without using dlookup?

                  what i'm trying to accomplish is filling a field with a value that is retrieved from another database so far as a 'username' or 'account number' is the same...

                  Comment

                  • vkong85
                    New Member
                    • Jun 2007
                    • 24

                    #10
                    ok so i was playing around with the macro and i seem to got it to work but there's another problem that popped up...

                    "The object doesn't contain the automation object ' description retrieved '. you tried to run a visual basic procedure to set a property or method for an object. However, the component doesn't make the property or method available for automation operations. Check the component's documentation for information on the properties and methods it makes available for automation operations."

                    Comment

                    • vkong85
                      New Member
                      • Jun 2007
                      • 24

                      #11
                      i figured out the problem. for future reference when using macro's to build an expression that will retreive a string value do not use an equals (=) sign in the expression field. the equal sign will command access to search for a property with the retrieved name which in many cases will give an error message. thanx rabbit for the help!

                      Comment

                      • Rabbit
                        Recognized Expert MVP
                        • Jan 2007
                        • 12517

                        #12
                        Originally posted by vkong85
                        i figured out the problem. for future reference when using macro's to build an expression that will retreive a string value do not use an equals (=) sign in the expression field. the equal sign will command access to search for a property with the retrieved name which in many cases will give an error message. thanx rabbit for the help!
                        Not a problem, good luck.

                        Comment

                        Working...