Simple MS Acccess Form - Checking Checkbox Crashes App


I have a very simple form. The main form is unbound. It has one combo and 2 checkboxes, for filtering results on the subform. The VBA has the default sql, for when the form is unfiltered and conditional where clauses to append, when any of the filters is turned on or off (after update of the combo, or checking/unchecking the checkboxes). This works fine in other apps. For some reason, in this application, the app is crashing if I check or uncheck either of the 2 boxes more than once. I can do it once and then if I do another check or uncheck, the app just crashes. This is all the code on the back of the form:

Private Sub Filters()
    Dim fSQL As String
    Dim nCount As Integer

    fSQL = "SELECT vwu.* FROM vw_UpdateFilterView vwu WHERE 1 = 1 "

    If Nz(Me.cboLocation.Value, 0) <> 0 Then
        fSQL = fSQL & " AND vwu.FKLocation = " & Me.cboLocation.Column(0)
    End If

    If Nz(Me.chkPUpdated, 0) <> 0 Then
        fSQL = fSQL & " AND vwu.ID Not in (Select FKPID From tblUpdatedPAccount)"
    End If

    If Nz(Me.chkNoBlankProfiles, 0) <> 0 Then
        fSQL = fSQL & " AND vwu.ID Not in (Select FKPID From tblUpdatedPAccount)" & " And nz(vwu.User,'')<> ''"
    End If

'Debug.Print Nz(Me.cboLocation.Value, 0) & " cboLocation"
'Debug.Print Nz(Me.chkPUpdated, 0) & " chkPUpdated"
'Debug.Print Nz(Me.chkNoBlankProfiles, 0) & " chkNoAcct"

'Debug.Print fSQL
    Me.frmUpdateMainPeopleAccounts_SubProfiles.Form.RecordSource = fSQL
    With Me.frmUpdateMainPeopleAccounts_SubProfiles.Form.RecordsetClone
        If .RecordCount > 0 Then .MoveLast
        nCount = .RecordCount
    End With
    Me.txtCountProfs = nCount & " People Profiles"
End Sub
Private Sub Form_Load()
End Sub
Private Sub cboLocation_AfterUpdate()
End Sub

Private Sub chkPUpdated_Click()
End Sub

Private Sub chkNoBlankProfiles_Click()
End Sub

Private Sub cmdReset_Click()
    Me.cboLocation.Value = Null
    Me.chkPUpdated.Value = Null
    Me.chkNoBlankProfiles.Value = Null
End Sub

Private Sub cmdMain_Click()
    OpenCloseForm "frmMain", "frmUpdatePProfiles", 0
End Sub

This is the event view error in the Windows Application log.

Faulting application name: MSACCESS.EXE, version: 14.0.7230.5000, time stamp: 0x5c6738e8
Faulting module name: ACECORE.DLL, version: 14.0.7237.5000, time stamp: 0x5d56d4bc
Exception code: 0xc0000005
Fault offset: 0x00059717
Faulting process id: 0x3810
Faulting application start time: 0x01d588e19f4ce5a1
Faulting application path: C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE
Faulting module path: C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\ACECORE.DLL
Report Id: 344fb181-f4d5-11e9-ad79-e8393534bdd2

I have created a new application and imported all the objects from the old one. I exported the form and subform as text, deleted the form and subform and then re-imported the text objects as forms. None of that has worked.

Any thoughts on how I can fix this?

asked on Stack Overflow Oct 22, 2019 by missscripty

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0