What causes invalid use of property in visual basic

Posted on 2006-03-29
Last Modified: 2008-01-09
I'm getting an compile error invalid use of property when using editmode on a Adodb recordset. The command is
rs.edit in the following code:
Set rs = cn.Execute("select * from [family info] WHERE [family #] = '" & FamilyNum & "' ")
If Not rs.EOF Then
  ' do your field update here.
End If
What is the reason for the invalid use of property?

Question by:whiwex
    LVL 24

    Expert Comment

    what options are you using on the open

    Expert Comment

    not sure if this is the solution cause I have no way of validating it. but shouln't rs.EditMode be followed by something like "True"

    Author Comment

    I addaed true to the edit but I get the same error

    Here's my open

    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\manna\database\manna families.mdb;Persist Security Info=False"
    LVL 14

    Accepted Solution

    First, you get this error because EditMode is a property, and not a method. You use a property to either set or get its value.
    For example:

      Form1.Caption="Hello"     'Here you set the value of the Caption property
      myString=Form1.Caption  ' Here you get the value of the Caption property

      Form1.Caption                 'Invalid use of property

    Second, the EditMode is a read-only property. Therefore, you cannot set its value. You can only "read" its value.
    Take a look at this:


      Nayer Naguib

    Author Comment

    Thanks your right. I thought you needed it to edit a selected record. I don't need it in my code.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    A short article about a problem I had getting the GPS LocationListener working.
    A short article about problems I had with the new location API and permissions in Marshmallow
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now