Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-Up Continous Form for Subform 2

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
I want to have a pop-up continuous form "SESSIONS_SOURCES" that appears upon clicking a unique record in parent form "SOURCES" which is embedded as a subform on the main form "CLIENTS". I created the "SESSIONS_SOURCES" table and corresponding form; however, upon attempting to link it to the parent form "SOURCES" I got a message that said a subform added to a subform cannot be coninuous. Not sure how to accomplish this link as well as unsure of how to make it a pop-up.
 
What do you want? A subform is by definition a control on a main form that generally has a form as its Source Object. "Pop-up" refers to a form that opens separate from any other form. I'm not sure how a subform can be pop-up or what you actually are asking.

Duane
Hook'D on Access
MS Access MVP
 
sorry, i guess i want the user to be able to click on a field in a subform and have a pop-up with additional details related to that subform appear. i thought in order to do this i had to create a subform with the additional details and then link it to the subform containing the field which would be clicked. i figured the pop-up part was just a visible/invisible property. if i'm way off then lead me in the right direction.
 
If you want a separate form to open, then just open the form with a WHERE CONDITION to filter the results in the open form. If there is a possibility of adding new records, you may want to set a default value on the foreign key field/control.

Duane
Hook'D on Access
MS Access MVP
 
Duane,
Am I missing something in that article? Aren't they just doing synchronized continous subform? Or is there more to it and I am not seeing it? I do not get the big Eureka moment and this mysterious "junior" and "senior" subform. It seems as if they have taken a not overly complicated task, made it more complicated then necessary, and act as if they made a great discovery. Even A97 version of Northwind demonstrates synchronized continous subforms.
 
I admit not really reading the article thoroughly. I was at work and noticed the link on my blackberry and was hoping it might provide some direction to the OP.

Duane
Hook'D on Access
MS Access MVP
 
if i have a separate form called "SESSIONS_SOURCES" that is linked to the subform "SESSIONS" by field "Session_ID", shouldn't it automatically filter results since when i select a client from my list box on the main form, it shows only sessions for that specific client and then when i select a specific session it should show only details for that specific session? i don't know what i am missing but i keep getting the details for all sessions (for all clients, not even just all sessions for the selected client!)
 
How do you have your "separate form... linked to the subform"? A main and subform can be linked using the Link Master/Child properties. There is no such functionality when opening a separate form.

Duane
Hook'D on Access
MS Access MVP
 
they are linked by "Session_ID" field and relationship is set up with 1 "Session_ID" from subform "SESSIONS" to many "Session_ID"s on separate form "SESSIONS_SOURCES". do i have to set up master/child properties on both forms and/or both source tables?
 
You might have relationships set up but if you have separate forms open, they typically are not "synchronized". There is no Link Master/Child between two different forms. A subform control contained on a main form will have link master/child properties.

Duane
Hook'D on Access
MS Access MVP
 
so do i need to filter the "separate form" based upon Session_ID since one unique session will be selected to "pop up" the "separate form"? when i set filter property on "separate form" to Session_ID it does not seem to filter properly.
 
If you want to open a new form with the records filtered to a value from the current form, you generally do this using the WHERE CONDITION of DoCmd.OpenForm.

This will not have any control over new records added to the new form. They won't default the value from the WHERE CONDITION into new records. If you need this functionality, you would need to set the default value of the control on the new form.

Duane
Hook'D on Access
MS Access MVP
 
Tried to use where condition by entering the following code:

Private Sub Command34_Click()
Dim strWhere As String
strWhere = Me.Session_ID
DoCmd.OpenForm "SESSIONS SOURCES", , , strWhere
End Sub

However, this causes "SESSIONS SOURCES" to open up full screen (wanted it to act similar to pop up, not full screen) and still did not filter properly even though I set where condition equal to Session_ID.
 
Your strWhere would probably resolve to something like:
Code:
DoCmd.OpenForm "SESSIONS SOURCES", , , "12"
"12" isn't a where condition, it is a number (or whatever). Typically a where condition might look like:
Code:
Private Sub Command34_Click()
  Dim strWhere As String
  strWhere = "[Session_ID] = " & Me.Session_ID
  DoCmd.OpenForm "SESSIONS SOURCES", , , strWhere
End Sub
If you want to open the form in a pop-up type mode, do a little reading in Help regarding the OpenForm method.


Duane
Hook'D on Access
MS Access MVP
 
cool--got the pop-up to work which also eliminates some of the other problems i was facing. anyways, to ensure new records entered also get filtered you said to set default value--should i simply set it to the unique field "Session_ID" or do i put in the entire code?
 
You add the SessionID value to the OpenArgs parameter of the OpenForm method. Add code to the On Open event of the new form to set the Default Value of the Session ID in the new form to the value from OpenArgs.

Please search around Help and/or google regarding OpenArgs and setting default values if you don't understand.

Duane
Hook'D on Access
MS Access MVP
 
I added the following but it still does not seem to pass the info to new records. I want to pass "Session_ID", "Sender Comp ID", and "Port" to all new records. I used "on load" instead of "on open" because it would open automatically instead of after clicking command button.

new form "SESSIONS_SOURCES":

Private Sub Form_Load()
Dim strOpenArgs As String
strOpenArgs = "[Port]" & "[Sender Comp ID]" & "[Session ID] = " & Me.Session_ID
End Sub

button on subform "SESSIONS":

Private Sub Command34_Click()
Dim strWhere As String
strWhere = "[Session ID]=" & Me.Session_ID
DoCmd.OpenForm "SESSIONS SOURCES", , , strWhere, OpenArgs:="[Session ID]=" & Me.Session_ID
End Sub
 
If you want to send values to the new form, then you need to send them all in the OpenArgs. The new, opened form needs to set the default values in the new form. I don't see anything in your code referencing default values.

Duane
Hook'D on Access
MS Access MVP
 
thanks for your helpful input. i am now successfully transferring default values to new records with the following code. everything is working perfectly except for
[Sender Comp ID] which keeps showing up as "0" in new records instead of text. how do i tweek the code to have this populate with text?

Private Sub Form_Load()
Dim bb As String
bb = [Port]
Text16.DefaultValue = Val(bb)
Dim cc As String
cc = [Session ID]
Session_ID.DefaultValue = Val(cc)
Dim dd As String
dd = [Sender Comp ID]
Text14.DefaultValue = Val(dd)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top