How do I create a subform programmatically?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a sub form in code - depending on data displayed in my main
form. I'm new to Access and VB
 
I need to create a sub form in code - depending on data displayed in my main
form. I'm new to Access and VB

Why?

Normally you would have a pretty much static set of forms; the data
displayed in the forms will vary, but creating new forms and new
controls is complex, time-consuming, and usually unnecessary.

What would be the purpose of this new subform? Can you instead have
subforms already created, perhaps on the pages of a Tab control?
What's the context?

John W. Vinson[MVP]
 
Hi John - Thanks for your interest! As you can tell I'm very new to Access
(work on AS400) but am OK with relational databases. I have a search 'Form'
containing 3 combos: Company, Job and Person. Users can select an entry from
any *one* of these and depending on which of them is selected a different
Form/SubForm combination is required. I'm using a stored Procedure to select
the appropriate records to display in each case. It's also important that the
'Search' screen (with the 3 combos) be available and visible throughout the
session.
I can correctly set the parameterfor the stored procedure but i'm not sure
how to associate this with the Form/Subform
Thanks,
jim
 
Hi John - Thanks for your interest! As you can tell I'm very new to Access
(work on AS400) but am OK with relational databases. I have a search 'Form'
containing 3 combos: Company, Job and Person. Users can select an entry from
any *one* of these and depending on which of them is selected a different
Form/SubForm combination is required. I'm using a stored Procedure to select
the appropriate records to display in each case. It's also important that the
'Search' screen (with the 3 combos) be available and visible throughout the
session.
I can correctly set the parameterfor the stored procedure but i'm not sure
how to associate this with the Form/Subform

I'd suggest having three subforms, one for each case, on your form;
set their Visible property to False so they won't be seen.

In the AfterUpdate event of each combo, set the appropriate Subform
back to visibility.

John W. Vinson[MVP]
 
Back
Top