locked
Unable to use scroll bar in a subform when fields are populated in main form RRS feed

  • Question

  • I have a very simple DB with a table (FundTable) and a form (Add New Fund). The form allows you to enter a fund code and title in fields and click a button to add the record to the FundTable. Within the form I added a subform (Fund_subform) so the user can view the records they add to the table from within the form.

    The issue I'm having is - if any of the fields on the form have characters entered into them, you are unable to click the scroll bar in the subform to move vertically or horizontally (using the scroll wheel works). The only way to restore the scrolling vertically/horizontally functionality is to click into a field and press ESC until all fields are cleared (simply highlighting entered text and deleting it does not work). Any help regarding this is appreciated.

    Below is all the VBA being used on the form. There is a User field on the form where the user enters his/her name so we can track who created each fund code (the name value is added in a column on the FundTable). Since we have it so the user field value remains populated after every fund code is created, the field needs to be cleared before any scrolling can be performed. If it would be helpful for me to upload the Access file somewhere for it to be looked at I can do that.

    Option Compare Database
    Option Explicit
    
    Private blnGood As Boolean
    
    'Button to add a new fund code to table
    Private Sub AddNewFundsFlowButton_Click()
    On Error GoTo ErrMsg
    Dim DefaultName As String
    
        blnGood = True
    
        'Ensures the user has entered his name before adding a new Fund Code
        If IsNull([User]) Then
            MsgBox ("Please enter your name in the User Name field before adding a new Fund")
            Exit Sub
        End If
        
        'Adds Fund Code to table, clears out Code and Title field, keeps name stored in User field, refreshes subform
        If Me.Dirty Then
            DefaultName = User.Value
            DoCmd.RunCommand acCmdSaveRecord
            DoCmd.GoToRecord , , acNext
            User.Value = DefaultName
            Fund_subform.Requery
        End If
        
        blnGood = False
        
        Exit Sub
        
    'Error message when user tries to create a Fund Code that already exists
    ErrMsg:
            Select Case Err.Number
                Case 3022
                    MsgBox ("This Fund has already been created.")
            End Select
        
    End Sub
    
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    
        If blnGood = False Then
            Cancel = True
        End If
    
    End Sub

    Tuesday, October 16, 2018 2:22 PM