Any obvious errors?

A

albycindy

I took this code straight out of Northwind and modified it for my subform.
Can anyone see any glaring errors?

Private Sub ActionID_AfterUpdate()
On Error GoTo Err_ActionID_AfterUpdate

Dim strFilter As String

strFilter = "ActionID = " & Me!ActionID

Me!Action = DLookup("Action", "tblAction", strFilter)
Me!ActionType = DLookup("ActionType", "tblAction", strFilter)

Exit_ActionID_AfterUpdate:
Exit Sub

Err_ActionID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ActionID_AfterUpdate

End Sub

I don't know what's going wrong. When I select the ActionID in subform
frmReturns, an error message tells me that it doesn't have that automation
object. I can't find automation object anywhere in help and I don't know what
it means...!

TIA
 
J

John Vinson

I don't know what's going wrong. When I select the ActionID in subform
frmReturns, an error message tells me that it doesn't have that automation
object. I can't find automation object anywhere in help and I don't know what
it means...!

It probably means that you're referencing the wrong control name or
the wrong form name. If there is no field or control named ActionID on
the form which contains this code you'll get this error.

If the code is on the mainform, and ActionID is on a subform, you need
to explicitly reference the path to the subform:

Me!frmReturns.Form!ActionID

instead of just Me!ActionID.

John W. Vinson[MVP]
 
Top