application defined or object defined error on form

  • Thread starter klp via AccessMonster.com
  • Start date
K

klp via AccessMonster.com

I have 2 forms. My main form which has a button to open another form(search
form) and be able to select the customer that is to be viewed. I actually
didn't create this form, a co-worker did and they are new to it. Well they
renamed the form, table etc. It looks as if everything is changed correctly
but for some reason my search form is erroring out. Not sure if it's because
of the name change or something else. This selection worked before until this
name change. So, On my search form, you can select a customer and click on
the select button, which has this logic:

varID = Me.frmActionRequestSearch_subform!ARID
If IsNull(varID) Or Err.Number = 2427 Then
MsgBox "There are no matching records found, vbExclamation"
Exit Sub
End If

On Error GoTo HandleErr

Forms!frmActionRequest!cboARID = Me.frmActionRequestSearch_subform!ARID
Forms!frmActionRequest!cboARID.SetFocus
Forms("frmActionRequest").cboARID_AfterUpdate


I have done a debug and stepped through the logic to see where this was
erroring out. It happens to error out on the last line:
Forms("frmActionRequest).cboARID_AfterUpdate

When I click on the select button I get application defined or oject defined
error. I don't see why I'm getting this.

this function is there and works here is the cboARID_AfterUpdate logic

Private Sub cboARID_AfterUpdate()
On Error GoTo HandleErr

Me.RecordSource = "SELECT * FROM qryActionRequestLoad WHERE ARID = " & Nz
(Me!cboARID, 0)

If Me.frmCost.SourceObject <> "" Then
Dim frm As Form_frmCost
Set frm = Me.frmCost.Form
End If


ExitHere:
Exit Sub

HandleErr:
MsgBox Err.Description
Resume ExitHere
End Sub

Any help is very much appreciated! Thanks!
 
J

Jeanette Cunningham

The code for the after update event of the combo doesn't seem to do much
This part of the code doesn't seem to do anything useful, after it the Set
frm = line.
Is there more to this bit of code?

If Me.frmCost.SourceObject <> "" Then
Dim frm As Form_frmCost
Set frm = Me.frmCost.Form
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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

Top