I have a form whose Record Source is a query (lists consumer information), with two subforms. One subform is for data entry and has a table for a record source (lists of authorizations, with foreign key ConsumerID). The other subform is used to view and edit the same data entered through the other subfrom, but it's record source is a query.
All of that works just fine. The problem is, I have a textbox that I using to search through the records on the main form with an OnChange event of
The search function works fine, BUT when I use it the data entry subform populates with one record from the subform record source, rather than being a blank data entry form. I have no idea why.
Does anyone know why this is happening, and how I can fix it?
All of that works just fine. The problem is, I have a textbox that I using to search through the records on the main form with an OnChange event of
Code:
Private Sub txSearch_Change()
Dim strFilter As String
On Error GoTo ErrHandler
If Me.txSearch.Text <> "" Then
strFilter = "[ConsumerLast]Like '*" & Me.txSearch.Text & "*' Or [ConsumerFirst]Like '*" & Me.txSearch.Text & "*'"
Me.Filter = strFilter
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
With Me.txSearch
.SetFocus
.SelStart = Len(Me.txSearch.Text)
End With
Exit Sub
ErrHandler:
Dim Response
Response = MsgBox("No consumers returned in search", vbOKOnly, "No Results")
txSearch = ""
DoCmd.Close
DoCmd.OpenForm "Consumers"
End Sub
The search function works fine, BUT when I use it the data entry subform populates with one record from the subform record source, rather than being a blank data entry form. I have no idea why.
Does anyone know why this is happening, and how I can fix it?