Cascading combos not working when in a subform

dragginthru

HMTL & CCS expert
Local time
Today, 17:18
Joined
Sep 21, 2005
Messages
63
Heya

Ive got my combos working fine now (thanks to all you kind folk on this forum!) but now that I have opened the main form (in which the combo box form is nested), once I have selected an item in the first one, and then click on the 2nd combo, a parameter box comes up saying "Forms!Training Record!Course_title_combo" and wants a value.

I cant see why this doesnt work when the form is nested, any ideas?

Gazz
 
You may not be referring the the form / subform stuff correctly. Make sure you use something like:

forms!myform!mySubFormControlName.form!myComboBoxName

Hope this helps...
 
eek i havent really touched on that yet, i can say [forms]![training record form]![combo_box_1] but i dont know about subform controls etc.

If i tell u the names and how the forms are nested you could show me?

the [Training Record] subform sits within a form called [Staff Details], which sits inside [surgery info] which sits inside [practice info]. I dont imagine you need to know all those tho :S

The combo box is called course_title_combo

Can you do anything with that? :o

Gazz
 
Ouch.

I think it would be easier for you to grasp what:

Code:
forms!myform!mySubFormControlName.form!myComboBoxName
Is doing.
 
the part i dont understand there is the MySubformControlname.form :eek: - i understand the rest of it I think
 
I can see where this is a problem. Usually, when I do a form / subform deal, I create the subform first. Just doing a normal form and saving it, say as subForm1. Then I create the mainform calling it something like mainForm1.
Then I put the subform control on mainForm1. Now the the sub form control can have a name that is different than the actual name of the form you want to use as the sub form. So the the name of the sub form control may get something like subformControl1. Finally, lets say on the sub form I have a text box named txtFirstName.

Now, if I have some code in the main form where I need to refer to the text box on the sub form, I would use something like:

forms!mainForm1!subformControl1.form!txtFirstName

The .form tells your code to look at something on the form that is in the control 'subformControl1'

Hope this helps....
 
That kinda makes sense Ken and I appreciate your help...

Im still confused...

What is a subformcontrol? Is this a series of properties for the frame that the subform sits in? i really cant get my head around it :S
 
Hum...

When you place a text box on a form, you are placing a control on the form. Same thing when you need a sub form on another form. You place a sub form control on the main form.

:)
 
So effectively the control is the combo box (in the form which the subform is nested in) that is the master link to the child one in the subform?
 
OK I know what the subformcontrols are now, thanks :)
I have checked on my forms and the subform controls all have the same names as the forms.

So the final hurdle - how do I reference it correctly? The form works FINE as a standalone- its only when as a subform that the problem occurs.

Heres the names (starting with the "top level" form)

(form) Data Entry
(ctrl) Surgery Info
(form) Surgery Info
(ctrl) Staff Details
(form) Staff Details
(ctrl) Training Record
(form) Training Record
(combo) course_title_combo
SELECT tbl_course_dates.course_date, tbl_course_dates.CourseID FROM tbl_course_dates WHERE tbl_course_dates.CourseID=forms![training record]![training record]!course_title_combo;

Ive tried a few putting: forms![Data Entry]![Surgery Info]![Surgery Info]![Staff Details]![Staff Details]![training record]![training record]!course_title_combo;

But that still brought up the parameter box.

Please help!!!! Then I can finally move on :)
 

Users who are viewing this thread

Back
Top Bottom