I have a query qrySimCatSolverType as follows-
SELECT tblSimCategory.SimCategoryID, tblProductSim.Product, tblProductSim.Application, tblProductSim.SolverTypes, tblProductInfo.Productdescription, tblOwner.OwnerFirstName, tblOwner.OwnerLastName, tblOwner.OwnerLoc, tblOwner.DomainID
FROM tblOwner INNER JOIN (tblProductInfo LEFT JOIN (tblSimCategory RIGHT JOIN tblProductSim ON tblSimCategory.SimCategoryID = tblProductSim.SimCategory) ON tblProductInfo.Productname = tblProductSim.Product) ON tblOwner.OwnerID = tblProductInfo.OwnerID
WHERE (((tblSimCategory.SimCategoryID) Like "*" & [Forms]![frmAdminShowRecords]![TextSimCatSolver] & "*")) OR (((tblProductSim.SolverTypes) Like "*" & [Forms]![frmAdminShowRecords]![TextSimCatSolver] & "*"));
The results of could be multiple records in the different fields or just one record. Depends upon the input in the Textbox
This is basically taking the input from a textbox called "TextSimCatSolver" and displaying results about SimCategoryID, SolverTypes, Product, Application, Productdescription, OwnerFirstName, OwnerLastName, OwnerLoc, DomainID from joined tables as indiacted above. The query runs perfectly fine on its own, but when I try to write it in a string statemnet to open the recordset to access the fileds and assign these to different controls like Combob box , textbox and combobox on my form, I get errors as "Run Time Error 13, Type Mismatch". This what i have so far..
Dim db As dao.Database
Dim rs As dao.Recordset
Dim st As String
st = "SELECT tblSimCategory.SimCategoryID, tblProductSim.Product, tblProductSim.Application, tblProductSim.SolverTypes, tblProductInfo.Productdescription, tblOwner.OwnerFirstName, tblOwner.OwnerLastName, tblOwner.OwnerLoc, tblOwner.DomainID FROM tblOwner INNER JOIN (tblProductInfo LEFT JOIN (tblSimCategory RIGHT JOIN tblProductSim ON tblSimCategory.SimCategoryID = tblProductSim.SimCategory) ON tblProductInfo.Productname = tblProductSim.Product) ON tblOwner.OwnerID = tblProductInfo.OwnerID WHERE ((((tblSimCategory.SimCategoryID) Like " * " & [Forms]![frmAdminShowRecords]![TextSimCatSolver] & " * ")) OR (((tblProductSim.SolverTypes) Like " * " & [Forms]![frmAdminShowRecords]![TextSimCatSolver] & " * ")))"
Debug.Print st
Set rs = CurrentDb.OpenRecordset(st)
Me.ListSimCategory = ra!SimCategoryID
Me.ListSolverTypes = ra!SolverTypes
Me.ComboProduct = ra!Product
Me.ComboApplication = ra!Application
Set rs = Nothing
Set db = Nothing
Pleas help me!
Thanks,
Priyanka