Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    12

    Unanswered: Dlookup trouble with FROM error

    I am trying to execute the following in a query:
    Expr1: DLookUp("[SumOfMean]","[Forb Total Cover]","[Well Pad]='" & [Well Pad] & "'")

    (So I want to look up thge "SumOfMean" from the query "Forb Total Cover" where the "Well Pad" IDs are the same.)

    When I try to run the query, I get the following error:
    The specified field [Well Pad] could refer to more than one table listed in the FROM clause of your SQL statement.

    How do I correct this?
    Thanks!

  2. #2
    Join Date
    Aug 2009
    Location
    Franklin, OH
    Posts
    44
    I think it could be resolved by including the table name with the field name:

    TableName!FieldName

    TableName.FieldName

  3. #3
    Join Date
    Nov 2008
    Posts
    12
    Thanks RaptorFish!

    I just tried

    Expr1: DLookUp("[SumOfMean]","[Forb Total Cover]","[Well Pad]= '" & [Monitoring Data Table].[Well Pad] & "'")

    which seemed to work. I had been fighting this all morning and could never get the syntax (or whatever the heck it is!) right until now.

    Thanks Again!

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Yes. Well done. Anytime you have multiple tables in your recordset, some of which have the exact same field names, you need to add the [MyTableName].[MyFieldName] into your expression.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Tags for this Thread

Posting Permissions

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