Solved Referencing a combobox in 2nd Subform, Vba Runtime error 2455 Invalid reference to the propery form / report (1 Viewer)

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
Hello, i am stuck to a problem which is annoying
Have a main form, Fr_Gala (single form) with two continues subforms (Frmsub_Races), and (Frmsub_Times)

I need this to work like ..
having swimming races in 1st subform, then in second subform which is linked as child to 1st,
one could type athlete's time, depending athlete's gender, to choose which athlete in cboathlete to have between men or women athletes
as the race's gender selected in first subform

i have tried referencing a combobox cboathlete in 2nd subform (from on current event in 1st Subform like
Forms!Fr_Gala!Frmsub_Times.Form!cboAthlete.Requery

and then..boom Runtime error 2455 Invalid reference to the propery form / report indicating
in debug that Forms!Fr_Gala!Frmsub_Times.Form!cboAthlete.Requery is wrong?

Can someone help?
 

Attachments

  • Database.accdb
    1.2 MB · Views: 144

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
Changed your Requery line to:
Forms![Fr_Gala]![Frmsub_Times].Requery
Also put Me.Form.Requery in the combobox After Update Event.
 

Attachments

  • SwimmerDatabase.accdb
    1.6 MB · Views: 127

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
Changed your Requery line to:
Forms![Fr_Gala]![Frmsub_Times].Requery
Also put Me.Form.Requery in the combobox After Update Event.
Thanks for helping me i suppose you have solved my issue. I ll confirm in the morning.. Great!!
 

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
I suppose it is getting quite strange i ve done as advised but no luck . ..
Only when change one time in 1st sub (Frmsub_Races) genderID, then 2nd s subform (Frmsub_Times) cboAthlete selects ok
Not automatically as intended
i dont know what am i doing wrong.
 

Attachments

  • Screenshot 2022-06-29 122350.jpg
    Screenshot 2022-06-29 122350.jpg
    101.7 KB · Views: 114
  • SwimmerDatabase.accdb
    5.1 MB · Views: 115

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
There were some other problems with your design which I corrected. Check the Record Source for the FrmSub_Times. When you select a record in the FrmSub_Races, the FrmSub_Times will requery and show the correct records.
 

Attachments

  • SwimmerDatabase.accdb
    5.1 MB · Views: 111

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
There were some other problems with your design which I corrected. Check the Record Source for the FrmSub_Times. When you select a record in the FrmSub_Races, the FrmSub_Times will requery and show the correct records.
Thank you i shall see those and learn by that
 

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
It might have not been uploaded in the corrected version, as far as i tested, still when gender in first sub is selected eg as for women, second subform' s athleteID is not populated by women athletes or the opposite
 

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
Maybe if typed something like
Code:
Forms!Fr_Gala!Frmsub_Times.Form!athleteID.RowSource = "SELECT athleteID FROM Tbl_Athletes WHERE (((Tbl_Athletes.agenderID)= " & Nz(Me.genderID, 0)
in the on current event of 1st subform but i cant do that without errors
 

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
OK. Let me look at what is happening when gender is selected.
 

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
Under Gala "Something" (Gala record 4), I was able to add Race data records and Time data records. I cannot read your language, so I am not sure what the data means. The Default Value of the GalaID field in the Races subform was not properly set so I set it to =[Forms]![Fr_Gala]![galaID]. There was also a criteria field in the Times subform Record Source that was wrong, so I corrected it.

It should work now. Just delete the records added in the Something gala if you don't want them. They are just test records.
 

Attachments

  • SwimmerDatabase.accdb
    5.1 MB · Views: 113

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
Thanks for helping it does not work...I have upload another Db, in which Fr_Galas is working as it should, however i need the two subforms to work in continues mode not datashhet mode, (which i did not managed doing) also in same database, Frmsub_races as a main form for testing is working ok with subform Frmsub_times..
I need in my Main form Fr_Gala, to have the two subforms in continues mode and with selected in 1st, a race for women or men athletes, to show - choose only women or men athletes according to my choice, like the demo i attached. Thank you!
 

Attachments

  • SwimmerDatabase ok.accdb
    1.8 MB · Views: 116
Last edited:

Cronk

Registered User.
Local time
Today, 10:06
Joined
Jul 4, 2013
Messages
2,771
The WHERE in the query
Code:
Forms]![Frmsub_Races]![genderID]

should be
Code:
Forms]![Frmsub_Races]!Form![genderID]
]

You got it right in the control source of txtRace in the header of the main form
 

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
Manos:
I am attempting to re-design the database so it meets ACCESS relational requirements. At the present time, it does not. It is never going to work as it is. I will give you a temporary file to look at later today (June 30, 2022) if I can. There are many relationships and tables and forms to change so they will work properly.

I have one question. What is the RoundNumber field in the Gala table mean? Is it the number of rounds in a single gala? Or does each individual race have many rounds?
 
Last edited:

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 01:06
Joined
Jul 9, 2003
Messages
16,273
Thanks for helping it does not work...

Depending on how you are addressing the control in the form in the subform/subreport control, the error might be because the subform hasn't loaded into the main form yet.

Sometimes you need to add the form to the subform/subreport control with VBA at a suitable time.
 

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
Depending on how you are addressing the control in the form in the subform/subreport control, the error might be because the subform hasn't loaded into the main form yet.

Sometimes you need to add the form to the subform/subreport control with VBA at a suitable time.
He has a lot more problems than that. The whole thing is a mess. I am going to attempt to make it work today.
 

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
Manos:
I am attempting to re-design the database so it meets ACCESS relational requirements. At the present time, it does not. It is never going to work as it is. I will give you a temporary file to look at later today (June 30, 2022) if I can. There are many relationships and tables and forms to change so they will work properly.

I have one question. What is the RoundNumber field in the Gala table mean? Is it the number of rounds in a single gala? Or does each individual race have many rounds?
hi Round No means it is eg 9th Olympic or 1st of Grammy Awards
 

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
In first picture is my sample Database relationships uploaded here. .(i uploaded a sample database and part of my real db).
It should work fine. Think of the logic of it.. problematic i think might be as for naming tables like that.
Maybe because i am doing this to help a friend and i dont have it with swimming and racing nomenclature of this sport..
In second picture is my DB relationships (and some are hidden)..
 

Attachments

  • 2022-06-30.jpg
    2022-06-30.jpg
    64.1 KB · Views: 109
  • All 2022-06-30 221630.jpg
    All 2022-06-30 221630.jpg
    200.6 KB · Views: 101
Last edited:

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
This is what I have so far:
1656617643400.png

And I am working on the forms.
 

Manos39

Registered User.
Local time
Yesterday, 17:06
Joined
Feb 14, 2011
Messages
248
There is no need to redesign my Database. It is working with the relationships.
(in your excample TbL_Times alone should hold info of the event (mean Distance - Stroke) otherwise athlete has a time but in which combination event) ?
Please take a look my latest attachment. Can say it is working like i want BUT please read
It has a main form and two sub forms running in DATASHEET view Which i need to have in Continues view and Which i am not able making it work like this exactly example and i don't know why!!

(Y will notice that HAVING selected for example in 1st sub form a race that is for women (γυναικων - means WOMEN'S) then in secont sub form, the choise given in athleteID is to choose between only women athletes to record their time)

All i need is a main form having the two sub forms included here working BUT In CONTINUES mode like here in my attached Database.
And i ask you why if someone turn these exactly sub forms to continues mode then whole thing (main forms with sub forms don't like it to work all right as this..?
 

Attachments

  • SwimmerDatabase.accdb
    1.8 MB · Views: 115
Last edited:

LarryE

Active member
Local time
Yesterday, 17:06
Joined
Aug 18, 2021
Messages
581
Here is what I have. It is much simplified and works. All subforms are continuous.
 

Attachments

  • SwimmerDatabase.accdb
    2.3 MB · Views: 121

Users who are viewing this thread

Top Bottom