We help IT Professionals succeed at work.
Get Started

search from 3 combobox

Wilder1626
Wilder1626 asked
on
367 Views
Last Modified: 2012-05-11
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

Comment
Watch Question
Social distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
CERTIFIED EXPERT
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE