Results 1 to 6 of 6
  1. #1
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88

    First Field when Disabled "Locks" the Entire Form + Fields + Buttons

    Not sure if this goes here but, I found that if I want to Disable (.Enabled = False) the first field in my form, the entire form along with all buttons and additional fields locks up like its disabled. The only fix to this is to make my first field .Locked = True then subsequent fields .Enabled = False. What is the reason for this? Am I doing something wrong? Thanks.



    BTW, I'm disabling fields under Form_Load() or under Form_Current() then when using my cmdNew button to enable them again. Disabling them as soon as I cmdSave.

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Can you post up the actual code used when you have the problem ?

    It sounds like you are inadvertently disabling the whole form / detail section rather than a specific control.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    This is the code that doesnt work for me...


    '---------------------------------------------------------------------------'
    '3. FORM CUSTOM DEFAULTS---DISPLAY RECORD COUNT BY FILTER AND HAVE ALL CHECKBOX DISABLED
    '---------------------------------------------------------------------------'
    Private Sub Form_Current()
    Me.Games.enabled = False 'this is the field that locks the entire form!!!!!

    Me.cmdNew.Enabled = True
    Me.Browse.Enabled = False 'this is the HDD search
    Me.cmdCoverSearch.Enabled = False 'this is ONLINE search
    Me.ConsoleName.Enabled = False
    Me.Copy.Enabled = False
    Me.Condition.Enabled = False
    Me.Remarks.Enabled = False
    Me.PricePaid.Enabled = False
    Me.DescBox.Enabled = False
    Me.cmdSave.Enabled = False

    'Enables all status fields'
    Me.InCollection.Enabled = False
    Me.Wishlist.Enabled = False
    Me.MissingCover.Enabled = False
    Me.Manual.Enabled = False
    Me.Case.Enabled = False
    Me.Favorite.Enabled = False
    Me.Rare.Enabled = False

    'Media type/filter'
    Me.Cartridge.Enabled = False
    Me.Disc.Enabled = False
    Me.HuCard.Enabled = False
    Me.NECCDi.Enabled = False
    Me.ISO.Enabled = False
    Me.Original30.Enabled = False
    Me.SEGA32X.Enabled = False
    Me.SEGACD.Enabled = False
    Me.VirtualConsole.Enabled = False
    Me.WiiWare.Enabled = False
    Me.SEGAMarkIII.Enabled = False

    'Display total games by filter'
    If Me.NewRecord Then
    Me.lblRecordCounter.Caption = "New Record"
    Else
    Me.lblRecordCounter.Caption = _
    " " & Me.Recordset.RecordCount
    End If
    End Sub

    Now the way I fix this is...


    '---------------------------------------------------------------------------'
    '3. FORM CUSTOM DEFAULTS---DISPLAY RECORD COUNT BY FILTER AND HAVE ALL CHECKBOX DISABLED---Part#1'
    '---------------------------------------------------------------------------'
    Private Sub Form_Current()
    Me.Games.Locked = True 'I lock this form and make it look like its disabled using the Color below
    Me.Games.BackColor = 15790320 'cell background/gray
    Me.Games.ForeColor = RGB(128, 128, 128) 'text highlight/gray

    Me.cmdNew.Enabled = True
    Me.Browse.Enabled = False 'this is the HDD search
    Me.cmdCoverSearch.Enabled = False 'this is ONLINE search
    Me.ConsoleName.Enabled = False
    Me.Copy.Enabled = False
    Me.Condition.Enabled = False
    Me.Remarks.Enabled = False
    Me.PricePaid.Enabled = False
    Me.DescBox.Enabled = False
    Me.cmdSave.Enabled = False

    'Enables all status fields'
    Me.InCollection.Enabled = False
    Me.Wishlist.Enabled = False
    Me.MissingCover.Enabled = False
    Me.Manual.Enabled = False
    Me.Case.Enabled = False
    Me.Favorite.Enabled = False
    Me.Rare.Enabled = False

    'Media type/filter'
    Me.Cartridge.Enabled = False
    Me.Disc.Enabled = False
    Me.HuCard.Enabled = False
    Me.NECCDi.Enabled = False
    Me.ISO.Enabled = False
    Me.Original30.Enabled = False
    Me.SEGA32X.Enabled = False
    Me.SEGACD.Enabled = False
    Me.VirtualConsole.Enabled = False
    Me.WiiWare.Enabled = False
    Me.SEGAMarkIII.Enabled = False

    'Display total games by filter'
    If Me.NewRecord Then
    Me.lblRecordCounter.Caption = "New Record"
    Else
    Me.lblRecordCounter.Caption = _
    " " & Me.Recordset.RecordCount
    End If
    End Sub

  4. #4
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    i also fixed it with...but I still wanted to know why the aforementioned was happening.

    '2. OnCurrent Default Setup
    '--------------------------------------------------
    Private Sub Form_Current()
    Dim ctrl As Control

    'Lock all textboxes
    For Each ctrl In Me.Controls
    If TypeOf ctrl Is TextBox Then
    ctrl.Locked = True
    End If
    Next

    'Lock all checkboxes
    For Each ctrl In Me.Controls
    If TypeOf ctrl Is CheckBox Then
    ctrl.Locked = True
    End If
    Next

    'Lock all drop-down menus
    For Each ctrl In Me.Controls
    If TypeOf ctrl Is ComboBox Then
    ctrl.Locked = True
    End If
    Next

  5. #5
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    What type of control is Games ?

    It's very helpful to rename controls with a prefix txtGames for instance would indicate a textbox control, you are doing it with your combo's, it might help going forwards as it can also distinguish between a control reference and referencing the underlying a field.

    You can also simplify your code and make it more flexible if you set a tag value on any controls you wanted locked, say LockTag , then your code becomes

    Code:
    Dim ctrl As Control
    
    'Lock all controls with a Tag value of LockTag 
    For Each ctrl In Me.Controls
         If ctrl.Tag = "LockTag" Then
            ctrl.Locked = True
         End If
    Next
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    thnx! this is what i've been doing since fixing that issue...ji was just wondering why it was happening at all.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  2. Replies: 6
    Last Post: 01-10-2015, 01:58 AM
  3. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  4. Replies: 4
    Last Post: 01-02-2012, 11:46 PM
  5. Replies: 1
    Last Post: 10-21-2010, 12:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums