|
-
Apr 15th, 2010, 01:57 PM
#1
Thread Starter
Member
[RESOLVED] Tab Control Form Set Focus--Now won't hide any pages (tabs)
I was getting an error when trying to hide a page on a tabbed form in access that you can't hide a control that has the focus. So I used a line of code Me.tabIwasnotusing.SetFocus and now it doesn't give me an error but it also isn't hiding any of the tabs as indicated below that line Here is the code for the form. I was having trouble with hiding "pgEvaluations"
[/CODE]
Option Compare Database
Option Explicit
Public frmType As String
Private Sub Form_Current()
frmType = Nz(Me.docChangeCategory, "General")
setProperties
End Sub
Private Sub Form_Load()
frmType = Nz(Me.OpenArgs, "")
If frmType = "" Then frmType = "General"
Call setProperties
End Sub
Public Sub setProperties()
showAllPages
Select Case frmType
Case "General"
With Me
.lblCaption.Caption = "Document Information"
End With
Case "Create"
With Me
.lblCaption.Caption = "Create SOP"
hidePage ("pgAnnualReview")
hidePage ("pgRetire")
End With
Case "PenAndInk"
With Me
.lblCaption.Caption = "Pen And Ink SOP"
Me.pgFinalized.SetFocus
hidePage ("pgEquipment")
hidePage ("pgEvaluations")
hidePage ("pgAnnualReview")
hidePage ("pgRetire")
End With
Case "Revise"
With Me
.lblCaption.Caption = "Revise SOP"
hidePage ("pgEquipment")
hidePage ("pgAnnualReview")
hidePage ("pgRetire")
End With
Case "Supplement"
With Me
.lblCaption.Caption = "Supplement SOP"
hidePage ("pgEquipment")
hidePage ("pgAnnualReview")
hidePage ("pgRetire")
End With
Case "Review"
Me.pgAnnualReview.SetFocus
With Me
.lblCaption.Caption = "Annual SOP Review"
hidePage ("pgEquipment")
hidePage ("pgEvaluations")
hidePage ("pgSignatures")
hidePage ("pgFinalized")
hidePage ("pgRetire")
End With
Case "Retire"
Me.pgRetire.SetFocus
With Me
.lblCaption.Caption = "RETIRE (Archive) SOP"
hidePage ("pgEquipment")
hidePage ("pgEvaluations")
hidePage ("pgSignatures")
hidePage ("pgFinalized")
hidePage ("pgAnnualReview")
End With
Case Else
MsgBox frmType
End Select
End Sub
Public Sub showAllPages()
Dim pg As Access.Page
For Each pg In Me.tabControl.Pages
pg.Visible = True
Next pg
End Sub
Public Sub hidePage(pgName As String)
Me.tabControl.Pages(pgName).Visible = False
End Sub
[CODE]
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|