run-time error

B

Bryan

When I open a form, I receive the following error message
that then points me to the script below. What's wrong?

Error Message: "Run-time error 2455 -- you entered an
expression that has an invalid reference to the property
Form/report"

Private Sub Form_Current()


=> Set MyControl = Forms![payables]!
[AddPayableCategory].Form![productid]
DoCmd.SelectObject A_FORM, "payables"
MyControl.Requery
Exit Sub

If jobid = False Then
Me.AllowEdits = True
Else
Me.AllowEdits = False


End If
End Sub
 
W

Wayne Morgan

Is AddPayableCategory the name of the subform or the name of the control on
the main form that holds the subform? It should be the latter.
 
G

Guest

Ignore my request. I deleted the reference/expression.

Thanks, Bryan
-----Original Message-----
Is AddPayableCategory the name of the subform or the name of the control on
the main form that holds the subform? It should be the latter.

--
Wayne Morgan
Microsoft Access MVP


Bryan said:
When I open a form, I receive the following error message
that then points me to the script below. What's wrong?

Error Message: "Run-time error 2455 -- you entered an
expression that has an invalid reference to the property
Form/report"

Private Sub Form_Current()


=> Set MyControl = Forms![payables]!
[AddPayableCategory].Form![productid]
DoCmd.SelectObject A_FORM, "payables"
MyControl.Requery
Exit Sub

If jobid = False Then
Me.AllowEdits = True
Else
Me.AllowEdits = False


End If
End Sub


.
 
Top