Results 1 to 12 of 12
  1. #1
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8

    Dsum invalid bracketing error

    I have this Dlookup query and it is giving me an error 2471 invalid bracketing for the field "[Tbl_Loan_Info.Tbl_Borrower_ID]

    AnnualLoanPayment = DLookup("Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payme nt", "QryAnnualLoanPayment", "[Tbl_Loan_Info.Tbl_Borrower_ID] =" _


    & Me.Tbl_Financial_Customer_ID & " And[Tbl_Loan_Info.Tbl_PropertyInfo_ID] = " _
    & Me.Tbl_FPropertryInfo_ID)

    MsgBox AnnualLoanPayment & "payment"


    The Borrower_ID is numeric

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Please show the SQL view of "QryAnnualLoanPayment".
    Is there really a space in this?
    "Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payme nt",

  3. #3
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    SELECT Tbl_Loan_Info.[Tbl_Borrower_ ID], Tbl_Loan_Info.Tbl_PropertyInfo_ID, Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payment, Tbl_Tax_Return.Tbl_Tax_Return_Year
    FROM Tbl_Loan_Info INNER JOIN Tbl_Tax_Return ON (Tbl_Loan_Info.[Tbl_Borrower_ ID] = Tbl_Tax_Return.Tbl_Borrower_ID) AND (Tbl_Loan_Info.Tbl_PropertyInfo_ID = Tbl_Tax_Return.Tbl_Tax_Return_Property_ID)
    WHERE Tbl_Tax_Return.Tbl_Tax_Return_Year = (SELECT MAX(Tbl_Tax_Return.Tbl_Tax_Return_Year) FROM Tbl_Tax_Return);

  4. #4
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    There is no space in "Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payme nt", It shows a space after copy and paste

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    See if this works

    [Tbl_Loan_Info].[Tbl_Borrower_ID]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    Not it did not work. It still gives me the same error

  7. #7
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    Run-Time error 2471
    The expression you entered as a query parameter produced this error: '[Tbl_Loan_Info].[Tbl_Borrower_ID]'

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I agree with Paul, I think you either have no square brackets or have them around each part.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Try taking all of the [ and ] out of your SQL. Try this.

    Code:
    AnnualLoanPayment = DLookup("Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payment", "QryAnnualLoanPayment", "Tbl_Loan_Info.Tbl_Borrower_ID =" _
    & Me.Tbl_Financial_Customer_ID & " And Tbl_Loan_Info.Tbl_PropertyInfo_ID = " _
    & Me.Tbl_FPropertryInfo_ID)

  10. #10
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    If I remove the brackets I get the same error. I have no idea and do not understand.

    The one below works perfectly:

    CashFlow = DLookup("[Tbl_Tax_Return.Tbl_Tax_Return_NetCashFlow]", "QryNetCashFlow", "[Tbl_Tax_Return.Tbl_Borrower_ID] =" _
    & Me.Tbl_Financial_Customer_ID & " And [Tbl_Tax_Return.Tbl_Tax_Return_Property_ID] = " _
    & Me.Tbl_FPropertryInfo_ID)
    MsgBox CashFlow & "cashflow"

  11. #11
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    I copied and pasted the code and still gets the Run-time 2471 error.The expression you entered as a ....

  12. #12
    MaryRod is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    Got it to work. I changed the query to

    SELECT Tbl_Tax_Return.Tbl_Borrower_ID, Tbl_Loan_Info.Tbl_PropertyInfo_ID, Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payment, Tbl_Tax_Return.Tbl_Tax_Return_Year
    FROM Tbl_Loan_Info INNER JOIN Tbl_Tax_Return ON (Tbl_Loan_Info.Tbl_PropertyInfo_ID = Tbl_Tax_Return.Tbl_Tax_Return_Property_ID) AND (Tbl_Loan_Info.[Tbl_Borrower_ ID] = Tbl_Tax_Return.Tbl_Borrower_ID)
    WHERE (((Tbl_Tax_Return.Tbl_Tax_Return_Year)=(SELECT MAX(Tbl_Tax_Return.Tbl_Tax_Return_Year) FROM Tbl_Tax_Return)));

    then I changed the code to

    AnnualLoanPayment = DLookup("Tbl_Loan_Info.Tbl_LInfo_Annual_Loan_Payme nt", "QryAnnualLoanPayment", "[Tbl_Tax_Return.Tbl_Borrower_ID] =" _
    & Me.Tbl_Financial_Customer_ID & " And Tbl_Loan_Info.Tbl_PropertyInfo_ID = " _
    & Me.Tbl_FPropertryInfo_ID)
    MsgBox AnnualLoanPayment & "payment"

    Thanks for your help

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Invalid bracketing of name
    By Access_Novice in forum Forms
    Replies: 2
    Last Post: 12-14-2013, 06:32 PM
  2. Replies: 16
    Last Post: 08-23-2013, 01:11 PM
  3. VBA Error: Invalid Bracketing of Name
    By kawi6rr in forum Programming
    Replies: 3
    Last Post: 02-21-2013, 05:26 PM
  4. Replies: 13
    Last Post: 12-12-2012, 08:17 PM
  5. Replies: 3
    Last Post: 04-12-2011, 10:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums