Changing Resource and fields on a subform

  • Thread starter Thread starter Tya via AccessMonster.com
  • Start date Start date
T

Tya via AccessMonster.com

I have a subform with fields on it that are present when i first open the
form. But when I click on a status button, I'd like the subform to change
the fields that are present.

For instance when i first open the fields are formid, lastname, firstname,
subject, date, range
But when i click on formstatus button, i'd like the fields to show: formid,
subject, range, product
I know how to use recordsource to change the recordsource, but then the
fields that I am not using show up as #name?

How do I get the subform to change field names so that the fields I am not
using, doesn't show up in the subform when I change the recordsource?

Thanks,
Tya
 
You could set the visible property of those controls to false. The drawback
here will be that you'll just have empty screen space where those controls
used to appear.

Another alternative might be to set the forecolor of those controls to white
(assuming the backcolor is white), then the controls would appear to be blank.

If you decide to try either of these methods, just make sure you have some
method of resetting the property back to normal
 
Hi Tya,
One option is to hide the controls that show up as #name, and show them when
you want to use them. The easiest way to do this is to have 2 different
forms for the subform control. The main form loads without any form inside
the subform control.When you click on the formstatus button, you put the
appropriate form inside the subform control.
Something like this:

If me.cmdStatus = True then
me.subform.sourceobject = "[Name of the form you want to use]"
else
me.subform.sourceobject = "[Name of the other form you want to use]"
end if

Jeanette Cunningham
 
Ah....
I changed the sourceobject to the subform name. I ended up creating 4-
subforms to match the 4-status queries that I have. Then on change in the
cmdStatus, I changed the sourceobject to the subform name i wanted to use.

Works Perfect....

Thanks Jeanette.

Tya

Jeanette said:
Hi Tya,
One option is to hide the controls that show up as #name, and show them when
you want to use them. The easiest way to do this is to have 2 different
forms for the subform control. The main form loads without any form inside
the subform control.When you click on the formstatus button, you put the
appropriate form inside the subform control.
Something like this:

If me.cmdStatus = True then
me.subform.sourceobject = "[Name of the form you want to use]"
else
me.subform.sourceobject = "[Name of the other form you want to use]"
end if

Jeanette Cunningham
I have a subform with fields on it that are present when i first open the
form. But when I click on a status button, I'd like the subform to change
[quoted text clipped - 13 lines]
Thanks,
Tya
 
Back
Top