Hi,
I have designed a search form for displaying related records, where user enters keyword in Textbox, and then another form opens which has Subform with datasheet view from desired table.
I want to display only records that has text string same as keyword, but my SQL statement doesn't work - all records are displayed in subform. Here's my code:
Where am I wrong, some design problems with subform ?Code:Private Sub CommandSearch_Click() Dim SearchString As String Dim Statement As String SearchString = Me.Text361.Value DoCmd.OpenForm "MyFormWithSubform", acNormal Task = "SELECT * FROM MyTable WHERE ((MyTableField LIKE ""*" & SearchString & "*""))" Me.RecordSource = Task End If End Sub