?
Solved

What causes invalid use of property in visual basic

Posted on 2006-03-29
5
Medium Priority
?
3,009 Views
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
 rs.MoveFirst
 rs.EditMode
  rs.Update
  ' do your field update here.
  rs.Close
End If
cn.Close
What is the reason for the invalid use of property?

Thanks
0
Comment
Question by:whiwex
5 Comments
 
LVL 20

Expert Comment

by:hes
ID: 16327794
what options are you using on the open
0
 

Expert Comment

by:martinezg
ID: 16327795
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"
0
 

Author Comment

by:whiwex
ID: 16327910
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"
cn.Open
0
 
LVL 14

Accepted Solution

by:
nayernaguib earned 2000 total points
ID: 16327953
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:

  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdproeditmode.asp

_______________

  Nayer Naguib
0
 

Author Comment

by:whiwex
ID: 16328043
nayernaguib
Thanks your right. I thought you needed it to edit a selected record. I don't need it in my code.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

850 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