Re: access crashing after filter



Dim fil As String

If cmbFilter.Value = "None" Then
fil = ""
ElseIf cmbFilter.Value = "Current" Then
fil = "B_Completed=0 AND B_Waived=0 AND B_Loss=0"
ElseIf cmbFilter.Value = "Completed" Then
fil = "B_Completed=1"
ElseIf cmbFilter.Value = "Waived" Then
fil = "B_Waived=1"
ElseIf cmbFilter.Value = "Loss" Then
fil = "B_Loss=1"
Else
Err.Raise 1024, "error"
End If

Set tRst = Me.Recordset
tRst.Filter = fil

If tRst.RecordCount = 0 Then
cmbFilter.Value = "None"
tRst.Filter = ""
tStr = "No records to list. Reverting back to NO filter"
MsgBox tStr, vbInformation, TITLE
End If

Set Me.Recordset = tRst 'Crash here after Form_Current completes
successfully
Debug.Print tRst.RecordCount


Correction on my previous post. cmbFilter.AfterUpdate does NOT
complete. On the line highlighted above, the Form_Current method
executes successfully but upon returning from Form_Current, it crashes
on the same line. It does NOT reach the DEBUG statement.

Please help.

Riyaz

.


Loading