Pop-up Forms

D

Dinamo/Pistons

Is Access capable to pop-up a subform(from the main form) based on a previous
field with predefined values?
For example I have 5 types of something and I want to ask different
questions for each type. How do I do this?
 
L

Larry Linson

Dinamo/Pistons said:
Is Access capable to pop-up a subform(from the main form) based on a previous
field with predefined values?
For example I have 5 types of something and I want to ask different
questions for each type. How do I do this?

When you determine the need to change the Form shown in the Subform Control,
set the Subform Control's Source Form property. That will not "pop it up"
but will display it in the Subform Control.

Larry Linson
Microsoft Office Access MVP
 
D

Dinamo/Pistons

Well that limits my choices to 1 form only.
I might have formulate wrong from the start.
I want my pop-up form (subform) to automatically change depending on the 5
options I have in the combobox above. For example if I choose first option
then click on by pop-up form (or subform) I want to see one form, if I choose
the second option I want to use a different subform and so on.
Can I do that?
 
L

Larry Linson

Terminology problem: a pop-up form is quite a different thing than a subform
control with a form displayed in it. A pop-up form is a separate form, which
is modal... must be responded to before anything else can be done.

From your statement, it seems you simply want to change what is displayed in
the subform control. And, I told you what to do... when you say "option",
are you talking about buttons in an option group?

If so, clicking a button will set a numeric value... let's assume you have
four option buttons in an option group, named grpChoose, and the values they
return are 1,2,4, or 8. On the same form, you have a Subform control named
sbfChangeable, initially set with a SourceObject of "frmSelectedWhite" and,
just so you can be sure about the number, a text box named txtValue. And you
have forms named frmSelectedBlue, frmSelectedGreen, frmSelectedOrange,
frmSelectedRed, and frmSelectedWhite, for each of which you have set the
Backcolor of the Detail Section to the color used in the form's name.

In the After Update event for grpChoose, use the following code

Select Case Me!grpChoose
Case 1
Me.txtValue = 1
Me.sbfChangeable.SourceObject = "frmSelectedBlue"
Case 2
Me.txtValue = 2
Me.sbfChangeable.SourceObject = "frmSelectedGreen"
Case 4
Me.txtValue = 4
Me.sbfChangeable.SourceObject = "frmSelectedOrange"
Case 8
Me.txtValue = 8
Me.sbfChangeable.SourceObject = "frmSelectedRed"
Case Else
Me.txtValue = Me.grpChoose
Me.sbfChangeable.SourceObject = "frmSelectedWhite"
End Select

Just to make sure, I created this, and it worked for me. (I think I misspoke
in my earlier reply and used "SourceForm" instead of the correct
"SourceObject".

Larry Linson
Microsoft Office Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top