I'm making use of a form to perform string searches in my database. I don't have much experience in VBA so I initially followed a guide to construct my first module. This worked out well, however when I tried to reapply the same process to any other form it gave me the same Runtime error 3075 : syntax error (missing operator) in query expression...
This one works as intended with no issues.
While this one of many others does not
I'm really at a loss here since the structure of the code is identical and I don't really get what is wrong.
This one works as intended with no issues.
Code:
Private Sub Searchbutton_Click()
Dim SQL As String
SQL = "SELECT Project_ID.Project, SAP.SAPNumber, Components.Component_Catalog_Number, Suppliers.Supplier, Assemblies.Assembly " _
& "FROM Suppliers INNER JOIN (SAP INNER JOIN (Project_ID INNER JOIN (Assemblies INNER JOIN Components ON Assemblies.[Assembly ID] = Components.AssemblyCID) ON Project_ID.Project_ID = Components.ProjectCID) ON SAP.SAPID = Components.SAPCID) ON Suppliers.SupplierID = Components.SupplierCID " _
& "WHERE [SAPNumber] LIKE '*" & Me.Searchbar & "*' " _
Me.subCsearch.Form.RecordSource = SQL
Me.subCsearch.Form.Requery
While this one of many others does not
Code:
Private Sub btnManuSearch_Click()
Dim SQL As String
SQL = "SELECT tblManufacturernum.ManufacturerNum, tblSubctype.ComponentType, tblManufacturername.ManufacturerName" _
& "FROM tblManufacturername RIGHT JOIN (tblSubctype RIGHT JOIN tblManufacturernum ON tblSubctype.SubctypeID = tblManufacturernum.SubctypeID) ON tblManufacturername.ComponentManufacturerID = tblManufacturernum.ComponentManufacturerID;" _
& "WHERE [ManufacturerNum] LIKE '*" & Me.txtManuSearchbar & "*' " _
Me.manufactsubsearch1.Form.RecordSource = SQL
Me.manufactsubsearch1.Form.Requery
I'm really at a loss here since the structure of the code is identical and I don't really get what is wrong.