Changing Subform

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

Guest

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!
 
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]
 
well im not sure if thats wat im looking for but maybe i can a better job at
explaining it:

i have a form called "preparer reminder select form" and pretty much what
this form has is a combo box a subform and a button. the combo box is used
to select the preparer name and the button is used to view the particular
reminders for that preparer. Now what i want is that when i click the
button, it chooses ONLY ONE of the 4 possible subforms to display (depending
on the preparer name chosen in the combo box) and hide the other 3 subforms.
i hope this helps u understand better.

thanks

PS i will try the code u posted anywayz

Ofer said:
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!
 
In the option I gave you, you don't have to create 4 subforms on the main
form, just one, and all you need to do is change the SourceObject of this sub
form depends on your selection
==============================
For your request, on the on click event of the button, you can write the code
Me.SubForm1Name.Visible = (Me.ComboName = "Value1")
Me.SubForm2Name.Visible = (Me.ComboName = "Value2")
Me.SubForm3Name.Visible = (Me.ComboName = "Value3")
Me.SubForm4Name.Visible = (Me.ComboName = "Value4")
--
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:
well im not sure if thats wat im looking for but maybe i can a better job at
explaining it:

i have a form called "preparer reminder select form" and pretty much what
this form has is a combo box a subform and a button. the combo box is used
to select the preparer name and the button is used to view the particular
reminders for that preparer. Now what i want is that when i click the
button, it chooses ONLY ONE of the 4 possible subforms to display (depending
on the preparer name chosen in the combo box) and hide the other 3 subforms.
i hope this helps u understand better.

thanks

PS i will try the code u posted anywayz

Ofer said:
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!
 
hey thanks a lot, it works beautifully!

Ofer said:
In the option I gave you, you don't have to create 4 subforms on the main
form, just one, and all you need to do is change the SourceObject of this sub
form depends on your selection
==============================
For your request, on the on click event of the button, you can write the code
Me.SubForm1Name.Visible = (Me.ComboName = "Value1")
Me.SubForm2Name.Visible = (Me.ComboName = "Value2")
Me.SubForm3Name.Visible = (Me.ComboName = "Value3")
Me.SubForm4Name.Visible = (Me.ComboName = "Value4")
--
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:
well im not sure if thats wat im looking for but maybe i can a better job at
explaining it:

i have a form called "preparer reminder select form" and pretty much what
this form has is a combo box a subform and a button. the combo box is used
to select the preparer name and the button is used to view the particular
reminders for that preparer. Now what i want is that when i click the
button, it chooses ONLY ONE of the 4 possible subforms to display (depending
on the preparer name chosen in the combo box) and hide the other 3 subforms.
i hope this helps u understand better.

thanks

PS i will try the code u posted anywayz

Ofer said:
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



:

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!
 
Any time, good luck with your project
--
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:
hey thanks a lot, it works beautifully!

Ofer said:
In the option I gave you, you don't have to create 4 subforms on the main
form, just one, and all you need to do is change the SourceObject of this sub
form depends on your selection
==============================
For your request, on the on click event of the button, you can write the code
Me.SubForm1Name.Visible = (Me.ComboName = "Value1")
Me.SubForm2Name.Visible = (Me.ComboName = "Value2")
Me.SubForm3Name.Visible = (Me.ComboName = "Value3")
Me.SubForm4Name.Visible = (Me.ComboName = "Value4")
--
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:
well im not sure if thats wat im looking for but maybe i can a better job at
explaining it:

i have a form called "preparer reminder select form" and pretty much what
this form has is a combo box a subform and a button. the combo box is used
to select the preparer name and the button is used to view the particular
reminders for that preparer. Now what i want is that when i click the
button, it chooses ONLY ONE of the 4 possible subforms to display (depending
on the preparer name chosen in the combo box) and hide the other 3 subforms.
i hope this helps u understand better.

thanks

PS i will try the code u posted anywayz

:

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



:

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!
 
This answer is valid if there are 4 fixed values. In my case ther are a lot
of values (>100) and regularly new values are added, ore 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!
 
Back
Top