Any obvious errors?

G

Guest

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Compile Error 2
output to pdf 4
Dlookup on Continuous Sub 4
AfterUpdate() event 1
Using varible with Dlookup 3
Problem with update coding 2
Attach File 4
Trouble auto populating field using DLookUp 3

Top