D347HxD
D347HxD

Reputation: 465

Subform requery error?

Private Sub ProjectSearchBtn_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    [ProjectQSubF].Requery
End Sub

Above is the code in one of my buttons. When I push said button (ProjectSearchBtn) it gives me a

"Rune-time error '2465': Microsoft Access can't find the field '|1' referred to in your expression.

What is wrong? I am quite confused, as this exact code (except changed button name + subform name) works elsewhere perfectly fine!

Upvotes: 1

Views: 351

Answers (1)

HansUp
HansUp

Reputation: 97131

When this line throws an error ...

[ProjectQSubF].Requery

... the reason might be that ProjectQSubF is the name of a form which is contained in a subform control.

If that is the case, Access will not recognize that name in this context. Instead, use the name of the subform control which contains that form. For example, if the name of the subform control is MySubForm, use one of these 2 alternatives ...

Me!MySubForm.Requery
Me!MySubForm.Form.Requery

You will need to identify the name of the subform control and substitute that for MySubForm.

Upvotes: 2

Related Questions