Combo on Subform..on Tab page

N

nycdon

I have a Tab control on Main Form (recordsource: Company) where I pulled a
subform for Program. On Program Subform is dropdown to select row using
Do.comd.applyfilter, ProgramID=me.comboPGM

The dropdown on subform works OK on its own, but when in Tab, get Parameter
msgbox for ProgramID..

any ideas?
thx!
Don
 
S

strive4peace

Hi Don,

if you are in code behind the main form, the combo would be referenced
like this:
me.subform_controlname.form.comboPGM

if you are applying a filter to the main from from code behind the subform:

me.parent.filter = "ProgramID=" & me.comboPGM
me.parent.filterOn = true

if you are applying a filter to the subform from code behind the subform:

me.filter = "ProgramID=" & me.comboPGM
me.filterOn = true

WHERE me.comboPGM is on the subform

the Tab control has nothing to do with it, Tab controls are just for
organizing -- whether it is a subform or not may be affecting it, but if
your combo is on the subform and you are applying a filter from the
subform, it would not make a difference either way

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
N

nycdon

Thanks Crystal - It doesn't seem to me that the control reference is off,
but get a parameter box to enter "ProgramID", which is a column in Subform
recordsource, rather than an error that reference is not valid.

i dont get the parameter box when i open subform on it's own.

thanks,
don
 
R

Rick Brandt

nycdon said:
Thanks Crystal - It doesn't seem to me that the control reference is
off, but get a parameter box to enter "ProgramID", which is a column
in Subform recordsource, rather than an error that reference is not
valid.

i dont get the parameter box when i open subform on it's own.

The reference changes when a form is used as a subform.. You have to reference
it by going through the parent form and subform control (the TabControl doesn't
matter).

Forms!ParentFormName!SubformControlName.Form!ComboBoxName
 
N

nycdon

Thanks Rick - but I dont seem to get a reference error. If I purposely make
the reference incorrect - get runtime 2465 - Cant find field referenced in
your expression.

When I correct the reference, I just get a parameter box for the column
"ProgramID" - the data piece of the expression, which is in the recordsource.
 
R

Rick Brandt

nycdon said:
Thanks Rick - but I dont seem to get a reference error. If I
purposely make the reference incorrect - get runtime 2465 - Cant find
field referenced in your expression.

When I correct the reference, I just get a parameter box for the
column "ProgramID" - the data piece of the expression, which is in
the recordsource.

Don't know about that. I can only assure you that if your reference is not like
my example then it won't work. Post your SQL.
 
S

strive4peace

Hi Don,

put ProgramID ON your subform -- you can make its Visible property = No
as well as delete the attached label

make sure the Name of the control is also ProgramID

.... see if this solves the problem :)

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Top