Error 2465 when referencing to a subform field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pawel
    New Member
    • Feb 2012
    • 1

    Error 2465 when referencing to a subform field

    Hi everyone,

    I got this error in Access and I really don't have any idea where it may come from...

    In a form with Clients ("DB Client companies - management"), I have a subform with contracted products ("DB Client companies products - management").

    In this subform, there is a button with VBA code behind (OnClick). When it's executed, I get the following error (2465):
    Microsoft Access can't find the field 'DB Client companies products - management' referred in your expression.

    The code that produces the error is (it's the first line of the code):
    Code:
     Me.[Range 1 price] = DLookup("[Range 1 price]", "[S Products list]", "[S Products list]![Product code]=[Forms]![DB Client companies - management]![DB Client companies products - management].[Form].[Product code]")
    I really don't know why it appears, as I copy-pasted the code from other form (with the same expression structure, just different elements) and there it works...
    I use Access 2010 on Windows 7.

    I will be extremely grateful for help. Thanks in advance.

    Regards,
    Pawel
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Try this and see if it works...
    Code:
     Me.[Range 1 price] = DLookup("[Range 1 price]", "[S Products list]", "[S Products list]![Product code]=[Forms]![DB Client companies - management]![DB Client companies products - management].Form![Product code]")

    Comment

    Working...