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

How to? A form with a tab control have generic command buttons

Status
Not open for further replies.

smsmail

Programmer
Aug 11, 2010
105
US
Hello,

Is it possible to have generic command buttons in the form header of a form that have a multi-page tab control?

I have a form that have a tab control with four unbound pages. Instead of each page having its own command buttons, I would like to have generic command buttons on the form header that would apply to all pages of the tab control. The command buttons are update, print, clear, etc.

If on a page the user clicks, for example the "update" command button, only the data on that particular page is updated. Is this possible?

If so, can you please give me a snippet example of what the code would look like. Let's say, the user made changes to fields in PAGE 1 of the tab control on a FORM, and clicked the generic UPDATE button in the HEADER section on the form, what would the code look like?

Thanks so much for your help!

smsmail
 
Sub cmdUpdate_click
Select case me.tabcontrol.Value
Case 0
.... some statment
Case 1
..
Case 2
....
Case 3

end select
end sub
 
How are ya smsmail . . .

Since the tab page controls are unbound, there's a little more to this than meets the eye.
smsmail said:
[blue]I have a form that have a tab control with four [purple]unbound pages[/purple].[/blue]
[ol][li]If you hit the [blue]UpDate[/blue] button ... update what to what?[/li]
[li]If you hit the [blue]Print[/blue] button ... print what in what way? Its better to have [blue]actual reports[/blue] setup for this.[/li]
[li] If you hit the [blue]clear[/blue] button ... this is easy:
Code:
[blue]Private Sub cmdClear_Click()
   Dim ctl As Control
      
   For Each ctl In Me.[[purple][b]TabControlName[/b][/purple]].Pages(Me.[[purple][b]TabControlName[/b][/purple]]).Controls
      If ctl.ControlType = acTextBox Then
         ctl = Null
      End If
   Next
   
End Sub[/blue]
[/li]
[li]You didn't give the 4th command button ... so don't know what to do.[/li][/ol]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top