View Full Version : Error in Form Code


bastagio
04-03-2008, 05:24 AM
Error 2465: Application-definded or object -defined error.

I know little about access but and trying to update an old database.

Below is the code that cause the error:

rivate Sub populateRecallNoticeData()
Dim whereClause As String
If Not formDoneDrawing Then Exit Sub

' Lookup Broker Contact And Delivery Instructions
whereClause = "instruct_id = " & [instruct_id]
currentRecallID = [recall_id]
Me.Parent.cboBrokerContactName.value = [broker_contact_id]
Me.Parent.tbDeliveryIns.value = DLookup("instruction", "delivery_instructions", whereClause)

' Show/Hide New Contact Name Capability
Me.Parent.activateNewContactName (broker_contact_id = ADD_NEW_BROKER_CONTACT)

The error brought me to the first me.parent line.

What does the error mean? What does me.parent mean?

Any suggustions on how to go about fixing it?

Any help would be greatly appreciated.

Thanks,
Sal

namliam
04-03-2008, 05:26 AM
This code is appearently beeng executed in a subform.
Are you by change opening the form without having it as a subform?

P.S. Welcome to the forum :D

bastagio
04-03-2008, 05:30 AM
haha thanks.

Basically what was going on is that I had a form and a subform in my current access database that works perfectly fine.

I ended up having too much info on one of the forms so I decided to speed it up I would remove some of the queries and place them on a second form. What I did was save as both the form and the subform.

When I try to open up the new form I saved as I get this error.

does me.parent mean the regular form of the subform?

Rabbie
04-03-2008, 05:33 AM
haha thanks.

Basically what was going on is that I had a form and a subform in my current access database that works perfectly fine.

I ended up having too much info on one of the forms so I decided to speed it up I would remove some of the queries and place them on a second form. What I did was save as both the form and the subform.

When I try to open up the new form I saved as I get this error.

does me.parent mean the regular form of the subform?

Me.parent is the mainform as seen from the subform.

namliam
04-03-2008, 05:35 AM
Me.parent is the mainform as seen from the subform.

Rabbie hit is allready...

This basicaly means that this (previous) subform will not work standalone while this code is in there...

bastagio
04-03-2008, 05:37 AM
so the only way me.parent will work is if I have the subform inside the form.?

I checked the form when I open it up the subform is where the data would be.

maybe its a naming issue? im assuming the issue is that all I did was save as both the form and subform without relinking everything together correctly, does that sound correct?

namliam
04-03-2008, 05:43 AM
so the only way me.parent will work is if I have the subform inside the form.?
This form or this code actually will only work if this form is a subform of another form...

I basicaly means you cannot open the subform without it actually beeing a subform... I needs its parent to be present...

The problem is not in saving, but in opening....

bastagio
04-03-2008, 05:55 AM
ok, so that makes much more sense now.

thats for the help!

Rabbie
04-03-2008, 05:58 AM
Happy to help.