Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

Invalid use of property

Using: Dim rs As dao.Recordset
there is a compile error in the following code:

   'v-- complile error: Invalid use of property ********
    rs = CurrentDb.OpenRecordset("SELECT tIssue.IssueID, tPeople.FirstName,

with "rs" selected.
-------
It goes away with Dim rs 'As dao.Recordset

But at line:

If rs.RecordCount > 0 Then <-- I get runtime error 438: Object doesn't support this property or method. The entire line "If rs.RecordCount > 0 Then" high-lighted yellow.

Question: Is this about some missing reference I need to add?

Thank you.
------------------

Function fnName(IssueID As Long, FirstName As String, LastName As String) As String

    Dim rs As dao.Recordset
    Dim c As String
         
    'v-- complile error: Invalid use of property ********
    rs = CurrentDb.OpenRecordset("SELECT tIssue.IssueID, tPeople.FirstName, tPeople.LastName FROM tRequest INNER JOIN (tPeople INNER JOIN " & _
            "(tIssue INNER JOIN tSponser ON tIssue.IssueID = tSponser.Issue_ID) ON tPeople.PeopleID = " & _
            "tSponser.People_ID) ON tRequest.RequestID = tIssue.Request_ID =" & IssueID)
   
    If rs.RecordCount > 0 Then
        rs.MoveFirst
        Do Until rs.EOF
            strTemp = rs!FirstName & ", " & rs!LastName + ", "
        Loop
   
    End If
   
    strTemp = Left(strTemp, Len(strTemp) - 2)
   
    rs.Close
   
    fnName = strTemp
   
End Function
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

What version of Access are you using?

Do you have a reference to Microsoft DAO 3.6 Object Library in your project?  the reason I ask is that intellisense will normally capitalize the DAO in dao.recordset if the reference is selected.
Avatar of Mike Eghtebas

ASKER

Access 2007,

Adding ADO 3.6 is not allowed, please see the attached messages.

With Access 2007, do we need DAO 3.6 or Access library 12.0 Object Library (assuming this is in conflict with DAO 3.6)?
ADO.bmp
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Gustav,

Nice to hear from you. I have been doing some java long enough not remember Set missing here.

Hi fyed,

Thank you for the comment.

Mike
Thanks. But haven't you been off for a while? Or have I cruised exactly around your comments?

/gustav
I had my focus on Java for a while. Have been in access area to earn some points now and then.

Mike