Full Version: WITH command not implemented well?
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Banaticus
Check out those commented out lines -- they work great. But, I thought I'd put in a WITH statement for less typing in the future if I have to change this again. I must have typed it wrong, what do you all think?
CODE
Private Sub Names_Locker()
    If [Name Toggle].Value = True Then
'        Me.Notes_Subform.Form.Form.AllowEdits = True
'        Me.Notes_Subform.Form.AllowDeletions = True
'        Me.Notes_Subform.Form.AllowAdditions = True
'        Me.Notes_Subform.Form.NavigationButtons = True
        With Me.Notes_Subform.Form
            .AllowEdits = True
            .AllowDeletions = True
            .AllowAdditions = True
            .NavigationButtons = True
        [Name Toggle].Picture = "F:\Access\redbutton.bmp"
    ElseIf [Name Toggle].Value = False Then
'        Me.Notes_Subform.Form.AllowEdits = False
'        Me.Notes_Subform.Form.AllowDeletions = False
'        Me.Notes_Subform.Form.AllowAdditions = False
'        Me.Notes_Subform.Form.NavigationButtons = False
        With Me.Notes_Subform.Form
            .AllowEdits = False
            .AllowDeletions = False
            .AllowAdditions = False
            .NavigationButtons = False
        [Name Toggle].Picture = "F:\Access\bluebutton.bmp"
    End If
End Sub
fkegley
You're missing the matching End With statements aren't you?
freakazeud
Where are your end with?
HTH
Good luck
Banaticus
Yes, thanks.
freakazeud
You're welcome.
Glad we could assist.
Good luck on future projects!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.