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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command button the opens forms

Status
Not open for further replies.

junior0090

Technical User
Nov 22, 2008
5
Hello all I would appreciate any help I can get I am stuck (pop rocks and 7 up on the desk) I have 1 main form and would like a button to open another form in the main window. any help would be appreciated thank you in advance
 
How are ya junior0090 . . .

Have you tried the [blue]Command Button Wizard?[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Pretty good TheAceMan1 hope all is well on your end.

I tried the command button wizard but it did not do what I wanted to do. I need the command button to act as a hyperlink and open the 2nd form in the existing window kinda like a web page.
 

You can't open one form in another form's window. The best you can do is to use the button to HIDE the one form and OPEN the other. It looks about the same from the user's perspective.

Code is "doCmd.OpenForm <form name>......." (intellisense will take you the rest of the way.)

Alternative:

Tab Control with subforms, but use invisible tabs. Put a subform on each tab and use your button to switch tabs programatically.

Code:

Create Tab control (tab1) with however many pages (Page1, Page2, Page3, etc.) Set Tab COntrol's STYLE to NONE.

Button can switch tabs with "Page3.SetFocus" or "Page2.SetFocus", etc.

Kirby
 
Another thing that works well is a subform which you swap out it's sourceobject:

Function cmd_ThisButton_Click()
Me.Detail.Controls("sfsr_SUBFORM").SourceObject = "sfrm_inbox"
End Function

Function cmd_ThatButton_Click()
Me.Detail.Controls("sfsr_SUBFORM").SourceObject = "sfrm_outbox"
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top