467,180 Members | 1,081 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,180 developers. It's quick & easy.

Load Subforms Dynamically?

I have an Access 2000 ADP main form called frmAD_OpeningForm that
needs to support several possible sub forms.

The subform that should appear would be based on the combined bound
values of two combo boxes that are located in the form header of the
main form. The way I have the combo boxes set up in the main form is
to have the user make a selection in each combo box, then click a
button named ‘Set' (and labeled ‘Set') to make the correct subform
appear. These subforms would appear in the Detail section of the main

When the form initially opens, there is a label in the detail section
(Label15) where the subform would go. This label text basically tells
the user to make a selection from both combo boxes, then click ‘Set'
to see a test. This label should not be visible when there is a
subform in the detail section.

I imagine the logic for what I am trying to do would go something like

On Set_Click
Set frmAD_OpeningForm!Label15.Visible = No
IF (When)
[Forms]![frmAD_OpeningForm]![Combo2]='HMKRL6' And
SETVALUE: ITEM: [Forms]![frmAD_OpeningForm]![frmBogusSubForm].[SourceObject]
IF (Other Combo2 Combo4 Combination)
SETVALUE : ITEM: (Same subform Source Object (???))
EXREPSSSION: (the subform per the Combo2 and Combo4 combination)
ELSE (evaluate 100+ possible combinations of Combo2 and Combo4 and
show the appropriate subforms)

While the user is in the main form, if changes are made to either
combo2 or combo4, and the user clicks the ‘Set' button, the current
subform would need to be ‘removed' and the new one ‘loaded' if the
combination of the combo boxes would represent a different subform.

When the main form is closed, all subforms would need to be ‘unloaded'
and frmAD_OpeningForm!Label15.Visible = Yes.

I have tried similar logic in a macro to evaluate one possible
combination of Combo2 and Combo4 and assigned it to the On Click event
of the ‘Set' button, but when I tried it, I got the following

The object doesn't contain the Automation object "frmOHMKRL6sub2".
You tired to run a Visual Basic procedure to set a property or method
for an object. However, the component doesn't make the property or
method available for Automation operations.
Check the component's documentation for information on the properties
and methods it makes available for Automation operations.

I think that this means that I can't perform a SET VALUE action on the
Source Object property of a subform. After I click okay on this
message, an ‘Action Failed' dialog box for the macro appears. The
macro does not run, and the frm0HMKRL6sub2 subform does not ‘load'
into the detail section of the main form.

What could I set up to make this work?

Thank you for your help!

Nov 12 '05 #1
  • viewed: 1690

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by CSDunn | last post: by
reply views Thread by Jack | last post: by
2 posts views Thread by Magenta | last post: by
3 posts views Thread by ApexData@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.