I am trying to do a search function to return all records associated with a name or part name. I have this code:
pID = "*" & UCase(Me.Text316.Value) & "*"
Me.RecordSource = "SELECT TOP 100 PERCENT itemsmain.*, customercategories.custcatdescr, itemstype.itemtypedescr, ModelTypes.ModelType, Departments.Department, " & _
"users.username, subrepairstatus.subrepair, itemsrepairstatus.status " & _
"FROM ((((((itemsmain " & _
"LEFT OUTER JOIN ModelTypes ON itemsmain.itemtypemodel = ModelTypes.ID) " & _
"LEFT OUTER JOIN customercategories ON itemsmain.custcatid = customercategories.id) " & _
"LEFT OUTER JOIN subrepairstatus ON itemsmain.subrepairstatus = subrepairstatus.ID) " & _
"LEFT OUTER JOIN Departments ON itemsmain.DeptID = Departments.ID) " & _
"LEFT OUTER JOIN itemsrepairstatus ON itemsmain.repairstatus = itemsrepairstatus.id) " & _
"LEFT OUTER JOIN itemstype ON itemsmain.itemtypeid = itemstype.ID) " & _
"LEFT OUTER JOIN users ON itemsmain.userid = users.id " & _
"WHERE UCase(itemsmain.custname) LIKE" & SQLStr(pID) & " " & _
"ORDER BY itemsmain.datein DESC"
To return all records containing the text in Text316, but it fails saying UCase not recognised.
How do I adapt this query? It's an adp.
pID = "*" & UCase(Me.Text316.Value) & "*"
Me.RecordSource = "SELECT TOP 100 PERCENT itemsmain.*, customercategories.custcatdescr, itemstype.itemtypedescr, ModelTypes.ModelType, Departments.Department, " & _
"users.username, subrepairstatus.subrepair, itemsrepairstatus.status " & _
"FROM ((((((itemsmain " & _
"LEFT OUTER JOIN ModelTypes ON itemsmain.itemtypemodel = ModelTypes.ID) " & _
"LEFT OUTER JOIN customercategories ON itemsmain.custcatid = customercategories.id) " & _
"LEFT OUTER JOIN subrepairstatus ON itemsmain.subrepairstatus = subrepairstatus.ID) " & _
"LEFT OUTER JOIN Departments ON itemsmain.DeptID = Departments.ID) " & _
"LEFT OUTER JOIN itemsrepairstatus ON itemsmain.repairstatus = itemsrepairstatus.id) " & _
"LEFT OUTER JOIN itemstype ON itemsmain.itemtypeid = itemstype.ID) " & _
"LEFT OUTER JOIN users ON itemsmain.userid = users.id " & _
"WHERE UCase(itemsmain.custname) LIKE" & SQLStr(pID) & " " & _
"ORDER BY itemsmain.datein DESC"
To return all records containing the text in Text316, but it fails saying UCase not recognised.
How do I adapt this query? It's an adp.