Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    11

    Unanswered: invalid use of property

    hi all,
    i am running the below code in access 2007 vba to access a created recordset using syntax:
    myRecordSet.Fields(0).Value but i am facing error:compile error :invalid use of property so please try to help me out.

    Sub hello()
    Dim cnn1 As ADODB.Connection
    Set cnn1 = CurrentProject.Connection
    Dim myRecordSet As New ADODB.Recordset
    myRecordSet.ActiveConnection = cnn1
    myRecordSet.Open "SELECT company FROM Table1"
    myRecordSet.MoveLast
    myRecordSet.Fields("company").Value
    End Sub

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    EDIT - brain fart

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    myRecordSet.Fields("company").Value
    You do nothing with this - you need to assign it to a variable, print it out, assign to a textbox. Something. But you can't just have it sat there like that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •