bikeski
asked on
Excel Marco, Firebird driver, ODBC Driver does not support the requested properties
I am receiving the following error message:
"Runtime error '-214727887(80040e21)'
ODBC driver does not support the requested properties"
I am trying to translate this SQL call into VBA
This is my attempt to convert the SQL into VBA
The error occurs at the line:
rs.Open strSQL, conSQL, adOpenStatic, adLockOptimistic
Thanks,
Ron
"Runtime error '-214727887(80040e21)'
ODBC driver does not support the requested properties"
I am trying to translate this SQL call into VBA
select count( co.orderid )
from customerorder co
join employee ee on ee.emplyid=co.emplyid join emplytimecard2 etc on etc.emplyid=co.emplyid and etc.scheddate=co.shipdate join timecarddetails2 tcd on tcd.timecardid=etc.timecardid and co.cds_ between tcd.startime and tcd.endtime where ( (tcd.emplytasks='SLS') or (tcd.emplytasks is null and ee.dept='SLS') or (tcd.emplytasks='MGM' and ee.dept='SLS') ) and co.orderstat='CP' and co.shipdate between '9/17/15' and '9/23/15'
This is my attempt to convert the SQL into VBA
Function SQLSCountTransactionsSalesSF(BegDate1, EndDate1) As String
SQLSCountTransactionsSalesSF = "Select COUNT( customerorder.orderid)AS sum_Sales" & _
" From customerorder" & _
" JOIN employee ON employee.emplyid=customerorder.emplyid" & _
" JOIN emplytimecard2 ON emplytimecard2.emplyid=customerorder.emplyid AND emplytimecard2.scheddate=customerorder.shipdate" & _
" JOIN timecarddetails2 ON timecarddetails2.timecardid=emplytimecard2.timecardid AND customerorder.cds" & _
" BETWEEN timecarddetails2.startime and timecarddetails2.endtime" & _
" WHERE ( (timecarddetails2.emplytasks='SLS') OR (timecarddetails2.emplytasks is null AND employee.dept='SLS') OR (timecarddetails2.emplytasks='MGM' AND employee.dept='SLS') )" & _
" AND orderdetail.orderstat = 'CP'" & _
" AND orderdetail.shipdate BETWEEN (" & BegDate1 & ") AND (" & EndDate1 & ") "
End Function
The error occurs at the line:
rs.Open strSQL, conSQL, adOpenStatic, adLockOptimistic
Function CountTransactionsSalesSF(B<wbr ></wbr>egDate1, EndDate1) As Variant
Dim conSQL As ADODB.Connection
Dim strSQL As String
Dim i As Integer
Dim Total As Variant
Dim rs As ADODB.Recordset
Total = 0
i = 0
Set conSQL = New ADODB.Connection
conSQL.Open "DSN=CDHO;Driver={Firebird<wbr ></wbr>/InterBase<wbr ></wbr>(r) driver};Dbname=192.168.0.2<wbr ></wbr>05:d:\mult<wbr ></wbr>idev\gdbcr<wbr ></wbr>eation\sv1<wbr ></wbr>020_012HO.<wbr ></wbr>gbb;CHARSE<wbr ></wbr>T=NONE;UID<wbr ></wbr>=BETAVIEW;<wbr ></wbr>Client=C:\<wbr ></wbr>Windows\Sy<wbr ></wbr>sWOW64\gds<wbr ></wbr>32.dll"
strSQL = SQLSCountTransactionsSales<wbr ></wbr>SF(BegDate<wbr ></wbr>1, EndDate1)
Set rs = New ADODB.Recordset
rs.Open strSQL, conSQL, adOpenStatic, adLockOptimistic
If Not rs.EOF Then
CountTransactionsSalesSF = rs.GetRows(-1, 1, "sum_sales")(0, 0)
If IsNull(CountTransactionsSa<wbr ></wbr>lesSF) Then
CountTransactionsSalesSF = 0
End If
Else
CountTransactionsSalesSF = 0
End If
conSQL.Close
End Function
This function works for many of my other SQL calls. However, none have the join statement.Thanks,
Ron
ASKER
Looks like something got messed up with my copy and paste in the original message.... It's still not working.
Function CountTransactionsSalesSF(BegDate1, EndDate1) As Variant
Dim conSQL As ADODB.Connection
Dim strSQL As String
Dim i As Integer
Dim Total As Variant
Dim rs As ADODB.Recordset
Total = 0
i = 0
Set conSQL = New ADODB.Connection
conSQL.Open "DSN=CDHO;Driver={Firebird/InterBase(r) driver};Dbname=192.168.0.205:d:\multidev\gdbcreation\sv1020_012HO.gbb;CHARSET=NONE;UID=BETAVIEW;Client=C:\Windows\SysWOW64\gds32.dll"
strSQL = SQLSCountTransactionsSalesSF(BegDate1, EndDate1)
Set rs = New ADODB.Recordset
rs.Open strSQL, conSQL, adOpenStatic, adLockOptimistic
If Not rs.EOF Then
CountTransactionsSalesSF = rs.GetRows(-1, 1, "sum_sales")(0, 0)
If IsNull(CountTransactionsSalesSF) Then
CountTransactionsSalesSF = 0
End If
Else
CountTransactionsSalesSF = 0
End If
conSQL.Close
End Function
is it the error stuck at line:
conSQL.Open "DSN=CDHO;Driver={Firebird /InterBase (r) driver};Dbname=192.168.0.2 05:d:\mult idev\gdbcr eation\sv1 020_012HO. gbb;CHARSE T=NONE;UID =BETAVIEW; Client=C:\ Windows\Sy sWOW64\gds 32.dll"
?
is the error message still the same as:
conSQL.Open "DSN=CDHO;Driver={Firebird
?
is the error message still the same as:
"Runtime error '-214727887(80040e21)'?
ODBC driver does not support the requested properties"
ASKER
Yes, same error,
stuck at:
rs.Open strSQL, conSQL, adOpenStatic, adLockOptimistic
stuck at:
rs.Open strSQL, conSQL, adOpenStatic, adLockOptimistic
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
figured out internally
>>strSQL = SQLSCountTransactionsSales
??
shoudn't it be as:
Function CountTransactionsSalesSF( egDate1, EndDate1) As Variant
strSQL = SQLSCountTransactionsSales
?
I guess you had done a mass replace and some of your codes had been replaced?
similarly to:
conSQL.Open "DSN=CDHO;Driver={Firebird
etc...
I don't quite understand this...