simflex
Constraint Violating Yak Guru
327 Posts |
Posted - 2004-06-20 : 17:17:11
|
I am been struggling with this now for awhile.Perhaps, someone might have an answer.I am trying to perform a where clause search with salary.I have one field on the database calle sal with datatype called currency.I need to pull names of those who are in some income bracket.So I go:Dim salary,selDatesalary = rst("sal")selDate = rst("fdate") ' Build our query based on the input. strSQL = "SELECT id,sal, min(sal) as beginSal,max(sal) as EndSal, min(fdate) as BeginDate, max(fdate) as EndDate,companyName, address,city,minorityStatus," _ & " state,zip_code,county,phone,faxnumber,incomeRevenue,employeeNumber, " _ & "headquarter,sic,naic " _ & "FROM sample " _ & "WHERE companyName LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR zip_code LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR phone LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR headquarter LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR city LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR Address LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR county LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "OR sal = " & salary & " " _ & "OR fdate = '# & selDate & #' _ & "OR minorityStatus LIKE '%" & Replace(strSearch, "'", "''") & "%' " _ & "GROUP BY id,companyName,address,city, minoritystatus,state,zip_code,county,phone,faxnumber,incomeRevenue,employeeNumber,headquarter,sic,naic,incomeRevenue " _ & "ORDER BY companyName;"First, I am getting type mismatch on the declaration of salary and date here:Dim salary,selDatesalary = rst("sal")selDate = rst("fdate")Then I am getting wrong expression here: & "OR sal = " & salary & " " _ & "OR fdate = '# & selDate & #' _Can anyone, please help,thanks in advance |
|