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!

Close Button on Subform 2

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
I am trying to put a "close" button on a subform using the following code:

Private Sub Command11_Click()
DoCmd.Close acForm, "SESSIONS_SOURCES", acSavePrompt
End Sub

However, this does not effectively close the subform, and when I tried to use the "Close Form" button in the wizard it closes the main form rather than just the subform.

Any help here would be appreciated.
 
A subform can't be 'closed'. What are you attempting to do? Do you want to just hide it or set the Source Document of the main form's subform control to a blank?

Duane
Hook'D on Access
MS Access MVP
 
i have the subform "sessions_sources" hidden to start. upon clicking a field in another subform, "sessions_sources" becomes visible. i then have a button on "sessions_sources" which i want to function as a "close" button, to make "sessions_sources" hidden again.
 

Perhaps...
1. Set focus to something on the main form.
2. Set the subform visible property to False.


Randy
 
it is functioning properly by hiding the subform upon clicking the button, but it doesn't seem to be seamless as it hesitates/flashes to top of main form and then moves focus back to proper subform as it closes. is there a way to make this seem "smoother" without a "transition"?

Private Sub Command11_Click()
Me.Parent.SESSIONS.SetFocus
Me.Parent.SESSIONS_SOURCES.Visible = False
End Sub
 
i need to keep the button on the subform that is acting as a sort of "pop up" in that it initially is hidden, becomes visible upon clicking field in a subform, and then needs a button to "close" it making it hidden again. therefore, the button to hide it again needs to be on the form that "pops up". can the transition not be avoided if this is the case? it would be much easier if i could simply use "close" function to hide subform!
 

The only reason I can think of that would require the Close button to remain on the "pop up" would be if the "pop up" were modal.
This doesn't seem likely in the case of a subform.
Did you at least TRY dhookum's suggestion?


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top