troubleshooting Question

MS Access VBA SQL Not Working Properly

Avatar of Dustin Stanley
Dustin Stanley asked on
Microsoft AccessVBASQL
10 Comments1 Solution100 ViewsLast Modified:
For some reason my SQL in VBA is showing blank in my forms box. The SQL works fine in a query. I have several other forms like this one and they all work fine but not this SQL for some reason. What's wrong with it?

Thanks for the help.
If Me!txtShowAllSourceJobs = True Then
'This will show all the jobs finshed or not.

 sSQL = "SELECT SourceSku.SourceSkuID, SourceSku.CustFirstNm, SourceSku.CustLastNm, SourceSku.CustBusNm, SKUs.SKU, Left([SkuNM],48) AS SkuName, SourceSku.dtmAdd, SourceSku.SourceJobComplete, SourceSkuStatus.Status, SourceSku.dtmEdit" _
& " FROM SKUs INNER JOIN (SourceSku LEFT JOIN SourceSkuStatus ON SourceSku.SourceSkuStatusID = SourceSkuStatus.SourceSkuStatusID) ON SKUs.SkuID = SourceSku.SkuID" _
& " WHERE (((SourceSku.SourceSkuID) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SourceSku.CustFirstNm) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SourceSku.CustLastNm) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SourceSku.CustBusNm) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SKUs.SKU) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((Left([SkuNm], 48)) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SourceSku.dtmAdd) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SourceSku.SourceJobComplete) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) Or (((SourceSkuStatus.Status) Like "" * "" & [Forms]![frmSourceSKUSearch]![SrchText] & "" * "")) ORDER BY SourceSku.SourceSkuID;"

 Forms!frmSourceSKUSearch!SearchResults.RowSource = sSQL
   Me!SearchResults.Requery
 
ASKER CERTIFIED SOLUTION
Dustin StanleyEntrepreneur

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros