Hello i'm trying to build a live search function in MS Access 2013 with a text box and continuous form.The text box and continuous form are in the same form, though the text box are in the header. This form is a subform of one other form, if it matters, let me know.
I'm trying to updated the continuous form with what the user is typing in the txtSearch control. The control have an On Change event, which will trigger the code behind when the controls value changes. With the query below I'm receiving run-time error 13. I'm not sure how to tackle it.
Below I've added additional information for those who find it helpful.
Control names:
- txtSearch
Code Behind: I've made a query in the original query to make the search query smaller and more readable. Not sure if this affects the search ability. All fields are supposed to be searchable though I've broken it down to one here to test it.
Private Sub txtSearch_Change()
SQL = "SELECT [qryPallställDetails].[SLA_ID], [qryPallställDetails].[ArtNr], [qryPallställDetails].[Benämning], [qryPallställDetails].[Saldo], [qryPallställDetails].[DtmReg], [qryPallställDetails].[InvDtm], [qryPallställDetails].[PV] " _
& "FROM [qryPallställDetails]" _
& "WHERE ((([qryPallställDetails].[Benämning])= " & Me.txtSearch.Text & "));"
Me.RecordSource = SQL
Me.Requery
End Sub
Original Query:(Not vb formatted.)
SELECT tblSLA.*, tblVerk.Verk, [tblVerkShelfs].[ShelfNumber] & [tblVerk_Place].[Place] AS VP,
[tblPallställ].[PName] & [tblPallställSection].[Section] & [tblPallställ_Row].[pallställRow] & [tblPallställPlace].[Place] AS PV,
[tblVerk].[Des] & [tblVerkShelfs].[ShelfNumber] & [tblVerk_Place].[Place] AS VD
FROM tblVerk
RIGHT JOIN (tblVerkShelfs
RIGHT JOIN (tblVerk_Place
RIGHT JOIN ((tblSLA
LEFT JOIN (tblPallställ
RIGHT JOIN (tblPallställSection
RIGHT JOIN (tblPallställPlace
RIGHT JOIN (tblPallställ_Row
RIGHT JOIN tblPallställData
ON tblPallställ_Row.PallställRow_ID = tblPallställData.PallställRow_ID)
ON tblPallställPlace.PallsällPlace_ID = tblPallställData.PallsällPlace_ID)
ON tblPallställSection.PallställSection_ID = tblPallställData.PallställSection_ID)
ON tblPallställ.Pallställ_ID = tblPallställData.Pallställ_ID)
ON tblSLA.SLA_ID = tblPallställData.SLA_ID)
LEFT JOIN tblVerkData ON tblSLA.SLA_ID = tblVerkData.SLA_ID)
ON tblVerk_Place.VerkPlace_ID = tblVerkData.VerkPlace_ID)
ON tblVerkShelfs.Verk_Shelf_ID = tblVerkData.Verk_Shelf_ID)
ON tblVerk.Verk_ID = tblVerkData.Verk_ID;
I've been looking for an answer, though i have not found an answer on what i'm trying to do.