Hi guys!
I have a Form with a subform in datasheet view, and a filter set with a combobox and a list. It all works ok until the user clicks on the datasheet, and then the first record on the table starts changing its data and it appears in other category, in particular the ones filtered. I dont know how to fix it, i tried setting it to read only on the subform, allow edits "no", locked it up, recordset type snapshot, SQL statements, nothing works. I went back on the code but nothing sounds strange enought to generate this error. Could anyone help me ? Thank you very much!!
Code:
Private Sub btnSearch_Click()
Dim varItem As Variant
Dim strSearch As String
Dim strBO As String
Me.DB_Milestone_Subform.Form.FilterOn = False
For Each varItem In Me!ListCategoria.ItemsSelected
strSearch = strSearch & "'" & Me!ListCategoria.ItemData(varItem) & "',"
Next varItem
If Len(strSearch) = 0 Then
If IsNull(Me.cboBO) Then
'do nothing
Else
strBO = Me.cboBO
Me.DB_Milestone_Subform.Form.Filter = " [BO] = ( '" & strBO & "' )"
Me.DB_Milestone_Subform.Form.FilterOn = True
End If
Else
If IsNull(Me.cboBO) Then
strSearch = Left(strSearch, Len(strSearch) - 1)
Me.DB_Milestone_Subform.Form.Filter = " Categoria IN ( " & strSearch & " )"
Me.DB_Milestone_Subform.Form.FilterOn = True
Else
strBO = Me.cboBO
strSearch = Left(strSearch, Len(strSearch) - 1)
Me.DB_Milestone_Subform.Form.Filter = " Categoria IN ( " & strSearch & " )AND [BO] = ( '" & strBO & "' )"
Me.DB_Milestone_Subform.Form.FilterOn = True
End If
End If
Me.GraphBO.Requery
End Sub