troubleshooting Question

search from 3 combobox

Avatar of Wilder1626
Wilder1626Flag for Canada asked on
Visual Basic Classic
13 Comments1 Solution368 ViewsLast Modified:
Hello all

I'm trying to do a search criteria based on 3 combobox. But the 3rd criteria could be based from 3 different column in my access dbase.

The result i have in my code is a syntax error: execution error '-2147217900 (80040e14)'

Do you know what it could be?

Thanks again for you help


Dim sSQL1 As String

Dim oRST1 As ADODB.Recordset

  Set oRST1 = New ADODB.Recordset

    Dim oConnect1 As ADODB.Connection

  Set oConnect1 = New ADODB.Connection


sSQL1 = "SELECT [ORIGIN],[DESTINATION],[DRY VAN],[HEATER],[REEFER] FROM [CP_RAIL 2011 rates] WHERE " _
            & "ORIGIN ='" & Form33.origin_cp_rail.Text & "' AND " _
            & "DESTINATION ='" & Form33.destination_cp_rail.Text & "' and " _
            & "DRY VAN ='" & Form33.commodity.Text & "' or " _
            & "HEATER ='" & Form33.commodity.Text & "' or " _
            & "REEFER ='" & Form33.commodity.Text & "'"
            
        

            oConnect1.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
            "Data Source=" & parameter.cp_rail.Text

 

oRST1.Open sSQL1, oConnect1

 
          Form33.CP_RAIL_rate.DataField = ""

          Set Form33.CP_RAIL_rate.DataSource = oRST1

        Form33.CP_RAIL_rate.DataField = "DRY VAN" Or Form33.CP_RAIL_rate.DataField = "HEATER" Or Form33.CP_RAIL_rate.DataField = "REEFER"

Open in new window

ASKER CERTIFIED SOLUTION
aikimark
Get vaccinated; Social distance; Wear a mask

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

Top Expert 2014

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 13 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 13 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