初めまして。早速ですが質問させて頂きます。
下記のようなソースを作成し、後の処理で取得件数による分岐を行いたいのですが、RecordCountを使うと取得できようが出来まいが「-1」しか返ってきません。使い方間違っているのでしょうか?
ご教示いただけれ幸いです。宜しくお願いします。
Private Function selectProducts(Shakei As String, Shaban As String) As ADODB.Recordset
Dim strSql As String
strSql = " select * " & _
" from d_sharyo "
If Shakei <> "" Then
strSql = strSql & "where SHAKEI_KEY = '" & Shakei & "'"
End If
If Shaban <> "" Then
strSql = strSql & " and SHABAN = '" & Shaban & "'"
End If
Set selectProducts = oraconn.Execute(strSql)
MsgBox (selectProducts.RecordCount)
End Function