M
Mr. T.
Hi,
i've got a form with a tabpage on it. On one of the tabs there's a second
tab-page. On one of the tabs of that 2nd tab-page there's a subform.
That subform is shown in datasheet view.
One of the fields on that subform is a dropdown with an sql instruction as
it's rowsource. Now i want the sql to be dependant of the value of a field
on the main form. The problem is i can't seem to reference that field from
the subform.
So in the dropdown's rowsource field i type
SELECT * FROM MyTable WHERE MyKeyField =
and after the = i've already tried with
Me.Parent.Form!MyControlName
Me.Parent!MyControlName
Parent!MyControlName
but that didn't work. When i go to the tab where that subform is, i get a
popup where it asks for the value of MyControlName.
Then i thought i'll set the sql from the main form, so in the main form
Current Event i put
Me.MySubForm.Forms.MyControlName.Rowsource = MySqlQuery
or MySubForm.MyControlName.Rowsource = MySqlQuery
but that didn't work either. I got the error that i referenced to the form
in the wrong way.
Has anyone got an idea how to do this or what i'm doing wrong? I'd prefer to
work the first way, so with the dropdown's Rowsource referencing to the
field on the main form throught the sql. I think that's the best way to do
it.
Any suggestions would greatly be appreciated.
Regards & thx in advance,
Thomas
i've got a form with a tabpage on it. On one of the tabs there's a second
tab-page. On one of the tabs of that 2nd tab-page there's a subform.
That subform is shown in datasheet view.
One of the fields on that subform is a dropdown with an sql instruction as
it's rowsource. Now i want the sql to be dependant of the value of a field
on the main form. The problem is i can't seem to reference that field from
the subform.
So in the dropdown's rowsource field i type
SELECT * FROM MyTable WHERE MyKeyField =
and after the = i've already tried with
Me.Parent.Form!MyControlName
Me.Parent!MyControlName
Parent!MyControlName
but that didn't work. When i go to the tab where that subform is, i get a
popup where it asks for the value of MyControlName.
Then i thought i'll set the sql from the main form, so in the main form
Current Event i put
Me.MySubForm.Forms.MyControlName.Rowsource = MySqlQuery
or MySubForm.MyControlName.Rowsource = MySqlQuery
but that didn't work either. I got the error that i referenced to the form
in the wrong way.
Has anyone got an idea how to do this or what i'm doing wrong? I'd prefer to
work the first way, so with the dropdown's Rowsource referencing to the
field on the main form throught the sql. I think that's the best way to do
it.
Any suggestions would greatly be appreciated.
Regards & thx in advance,
Thomas