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

[b]Make subform visible based on the value of option group.[b]

Status
Not open for further replies.

LD1010

Technical User
Dec 6, 2001
78
US
Thanks for reading my post.
I have a subform on my main form that I want to make visible only when the value of an option group equals 7 or 8, if the value is between 1 - 6 the subform is to remain invisible. The default value of the option group is 1. I have the visible property of the the subform set to False. I've tried the following code but it but the subform always remains visible.
Any help would be much appreciated.
Code:
Private Sub fraProgramClaim_AfterUpdate()

    If Me.ProgramClaim.Value = 7 Or 8 Then
    Me.sfrmPCDates.Visible = True
    Else
    Me.sfrmPCDates.Visible = False
    End If
        
End Sub

Private Sub Form_Current()

    If Me.fraProgramClaim.Value = 7 Or 8 Then
    Me.sfrmPCDates.Visible = True
    Else
    Me.sfrmPCDates.Visible = False
    
    End If
        
End Sub
 
That's not how you write conditions.
Code:
If Me.fraProgramClaim.Value = 7 Or 8 Then

Should be:
Code:
 If Me.fraProgramClaim.Value = 7 Or _ 
      Me.fraProgramClaim.Value = 8 Then

I would use:
Code:
Private Sub SetPCDatesVisible()
    Me.sfrmPCDates.Visible = (Nz(Me.ProgramClaim,0) >= 7)
End Sub

Private Sub fraProgramClaim_AfterUpdate()
    SetPCDatesVisible        
End Sub

Private Sub Form_Current()
    SetPCDatesVisible        
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Thanks Duane for your help once again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top