Hi.
Im having a problem with an SQL statement.
Using VB6 and connecting to an Access 2000 database using an ADO Recordset i keep getting errors.
The database has 1 table named tbl_Master, from that table i need to select th following fields, ourref, yourref, date, insured2, totalcharges, insurancecompany and paymentreceived.
From these fields i need to return the data that matches 2 conditions,
a) the insurance company name in cboInsCo and
b) when paymentreceived = NO

Below is the SQL statement that i am using,


Private Sub cmdLst_Click()
Dim InsList As String
InsList = cboInsCo.Text

Set cn = New ADODB.Connection
cn.ConnectionString = "Provider =Microsoft.Jet.OLEDB.4.0;" & "Data Source = C:\SKM_ICE Database\SKM_ICE DBase.mdb"
cn.Open
Set rsAccounts = New ADODB.Recordset
rsAccounts.Open "SELECT OurRef, YourRef, Date, insured2, totalcharges"
From tbl_master
Where insurancecompany = InsList And PaymentReceived = "NO"

rsAccounts.Close
cn.Close
Set rsAccounts = Nothing
Set cn = Nothing

End Sub