Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2465 Application-defined or object-defined error

Status
Not open for further replies.

integritycare

Technical User
Mar 12, 2011
151
0
0
AU
Hi All,

I am using some code by Daniel van den Berg re having a star rating on a form. On the subform it works ok.But when the subform is on the navigation Form (access 2007) it gives this error.
The code below is on the subform
Code:
Private Sub Form_Current()
SetRating Form_RecipesNew, Me.cRating
End Sub

The code on the star image is below. There are 5 stars with identical code except for the img no
Code:
Private Sub imgSt1_Click()

SetRatingClick Me.imgSt1, Me.cRating

End Sub
I think is it due to relationships between the Navigation Form and the subform. Just need some help to figure this out please.

KP




 
Try this.
Private Sub Form_Current()
Forms![Main Form Name]![Form_RecipesNew].Form.cRating
End Sub
I hope that helps.
 
Hi Laurie,
Thank you for your reply. I had previously tried this reference plus many others! But still comes up with this error when you click on a star.

Perhaps the only way is to make the recipe form a pop up form which works, and then the user can rate his recipe.
What do you think?
 
I truly do not mean to insult your intelligence here, just checking - you did put in the name of the main form in
Forms![Main Form Name]![Form_RecipesNew].Form.cRating? I copied that right from my own code and it worked for me. What version of Access are you using?
If it works as a pop up, go for it!
 
Hi Laurie..
Thanks for your reply.
Just to try it again,
I used a blank form (Form2) and used Recipes-New as a subform.
On the after event of the Recipes New is below
Code:
Forms![Form2]![Form_Recipes-new].Form.cRating

Still have the same issue.
When the form opens I just get this error, MS access can't find the field 'Form_Recipes-New referred to in your expression'
So I think I will just go with a pop up form where the code works ok. Just wasted enough time on it.

Thank you for your help
KP
 
integrity:

I think that you may have fallen into the trap that I did (years ago).

Your sub-form does not sit DIRECTLY on your parent form, it is sat within a 'container' that holds your sub-form.
So, when you state: Forms![Form2]![Form_Recipes-new].Form.cRating, 'Form_Recipes-new' IS NOT referencing your sub-form, but your sub-forms CONTAINER (which then references your sub-form via the use of '.form')

Right-click the OUTER edge of your sub-form (that is on your master form), and select 'properties'.
You should see a completely different name, which is your sub-form container name.

It is THAT name that you should refer-to in:

Code:
 Forms![Form2]![Form_Recipes-new].Form.cRating (in place of [Form_Recipes-new]).
   ^      ^            ^            ^       ^
   |      |            |            |       |
Command Parent     Container    Sub-form  Control

Replace [Form_Recipes-new] with that container name.

Sorry if I'm wrong (great if I'm right and you now know how it works).

Def
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top