I have a form with an unbound textbox (txtSearch) and a listbox (myList). I modified the row source in my listbox to accomplish a union query. The new feature gives me the ability to select a record in my listbox then it would display the results in a query table. However the search feature no longer works.
Previous Codes:
myList rowsource:
Code:
SELECT tablename.fielname1, tablename.fielname2, tablename.fielname3,tablename.fielname4
Criteria:
Code:
Like [Forms]![frmName]![txtSearch] & "*"
textbox code:
Code:
Private Sub txtSearch_Change()
Me.myList.Requery
Me.Refresh
Me.txtSearch.SelStart = Me.txtSearch.SelLength
End Sub
myList New rowsourcecodes:
Code:
SELECT DISTINCT tablename.fieldname1,tablename.fieldname2,tablename.fieldname3 FROM tablename UNION select tablename.fieldname1,tablename.fieldname2,tablename.fieldname3;
I also created a command button (on_Click) to general the results in a query table.
Help..