Changing subform (continued)

B

BlackKnight

The answer below is valid if there are 4 fixed values. In my case there are a
lot
of values (>100) and regularly new values are added, or values are changed.
Is it possible to to do this with a table with 2 fields ("Value" and
"FormName"), so that I can do the changes in the table and don't have to
recode the form.
If so, please tell me how to code this.

Thanks in advance !
(Sorry for the incorrect English, I'm not a native speaker)



"Ofer" schreef:
On the After Update of the field in the main form, write the code

Select Case Me.Fieldname
case "Value1"
Me.SubFormName.SourceObject = "Form1Name"
case "Value2"
Me.SubFormName.SourceObject = "Form2Name"
case "Value3"
Me.SubFormName.SourceObject = "Form3Name"
case "Value4"
Me.SubFormName.SourceObject = "Form4Name"
End Select
===============================
Now, if you want to filter the sub form depending on the value selected in
the text box, then you can create a reference from the record source of the
sub form to the field in the main form

Select * From TableName Where FieldName =
Forms![FormName]![FieldNameInTheForm]
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck


HOW DO I CREATE A SEARCH FORM???? said:
Hi and thanks in advance for your help,

okay, here is the situation, i have a form and that form has a subform that
displays data depending on what data is in a field on the main form. Now
what i want is for this subform to be composed of 4 forms but i want it to
display a certain form depending on the field that is chosen on the main
form. I hope im clear enough

thanks!
 
Top