470,841 Members | 905 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,841 developers. It's quick & easy.

result set invalid use of property

I have the following code

Private dataEnviron As dataEnv
Private DBconn As Connection

Private Sub Class_Initialize()
Set dataEnviron = New dataEnv
Set DBconn = dataEnviron.OracleConn
DBconn.Open
End Sub

(1)Function getAppointmentsOnDate(ByVal appDate As Date) As Recordset
Dim rs As Recordset
Set rs = DBconn.Execute("SELECT * FROM Appointments WHERE AppDate
= " & appDate)
(2) getAppointmentsOnDate = rs
End Function
But every time I try to run it, I get an "Invalid use of property"
error with VB highlighting (1) in yellow and selecting (2).
Can I return resultsets in this way?

Any help would be appriciated

Jagdip Singh Ajimal
Jul 17 '05 #1
1 6052
js*****@hotmail.com (Jagdip Singh Ajimal) wrote in message news:<c8**************************@posting.google. com>...
<cut>
(1)Function getAppointmentsOnDate(ByVal appDate As Date) As Recordset
Dim rs As Recordset
Set rs = DBconn.Execute("SELECT * FROM Appointments WHERE AppDate
= " & appDate)

Set getAppointmentsOnDate = rs
End Function


BTW, you need to format the date properly or it may not work on
systems that have different local regional settings. Assuming SQL:

sQuery = "SELECT * FROM Appointments WHERE AppDate = '" & _
Format$(AppDate,"yyyy-mm-dd") & "'"
Set rs = DBconn.Execute(sQuery)

You don't have to build the string separately but I find it helps
debugging since you can stop on the Set statement and view the actual
formatted query easily.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by William Drew | last post: by
6 posts views Thread by Nicolae Fieraru | last post: by
3 posts views Thread by Twanger | last post: by
5 posts views Thread by Mark Ingram | last post: by
3 posts views Thread by JRough | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.