473,748 Members | 10,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Message After Inserting a "rs.edit" command



Hey guys, I'm rather new to access and can not seem to figure out what
is wrong with this code I will post below...but first...it was working
perfectly fine before I added this:

recSet2.Edit
recSet2.Fields( "DateDifference ") = UntilCompletion
recSet2.Update

As was suggested by a helpful friend at TheScripts

My Access suggests I use recSet2.EditMod e instead

either way I end up with an error message

If I use recSet2.Edit then my error message is "Method or data member
not found (Error 461)"

If I use recSet2.EditMod e then my error message is "Invalid use of
Property"

but although it is the .Edit or .EditMode that get's highlighted as if I
highlighted it myself (in blue), it is the declaration of the function
that get's highlighted in yellow which is "Public Function
DaysToCompletio n() As Long" -- I have changing this to "Private Sub
DaysToCompletio n()" and that made no difference

And now for the full code (No need to read the commentary, I was adding
it to remind myself exactly what I was doing):

Option Compare Database

Public Function DaysToCompletio n() As Long

'Opening tblContracts as recSet1
Dim con1 As ADODB.Connectio n
Dim con2 As ADODB.Connectio n
Dim recSet1 As ADODB.Recordset
Dim recSet2 As ADODB.Recordset
Set con1 = CurrentProject. Connection
Set con2 = CurrentProject. Connection
Set recSet1 = New ADODB.Recordset
Set recSet2 = New ADODB.Recordset
recSet1.Open "tblContrac ts", con1
recSet2.Open "tbldtdiff" , con2
Dim x As Long

'Declaring UntilCompletion as the amount of days until completion
Dim UntilCompletion As Long

'Looping until EOF (until the last record for EndDate in
tblContracts... so
'someone else would have declared recSet1.Open
'"tblWhateverYo urTableNameIs", con1 which means
'connection1 and then to open a field in that recordset you type
'recSet1.Fields ("fieldname" ))
x = 0

recSet1.MoveFir st
Do Until recSet1.EOF
' End Date must be in quotes or will not work
UntilCompletion = DateDiff("d", Date, recSet1.Fields( "EndDate"))
Debug.Print UntilCompletion
recSet2.EditMod e
recSet2.Fields( "DateDifference ") = UntilCompletion
recSet2.Update
recSet1.MoveNex t
x = (x + 1)
Loop

'Clearing recSet1 and Con1 (Connection1) and recSet 2 and Con1
recSet1.Close
recSet2.Close
con1.Close
con2.Close
Set con1 = Nothing
Set con2 = Nothing
Set recSet1 = Nothing
Set recSet2 = Nothing

End Function

Any help would be much appreciated!

Cheers,

Kosmös

*** Sent via Developersdex http://www.developersdex.com ***
Dec 19 '06 #1
1 2906
On 19 Dec 2006 14:06:02 GMT, Kosmös Pollard <j2**@brandeis. eduwrote:

..Edit is used for DAO recordsets, and is not needed for ADO
recordsets.
The difference between .Edit and .EditMode can be found in the help
file. Don't become a tinkerer. Write code you understand.

-Tom.
>

Hey guys, I'm rather new to access and can not seem to figure out what
is wrong with this code I will post below...but first...it was working
perfectly fine before I added this:

recSet2.Edit
recSet2.Fields( "DateDifference ") = UntilCompletion
recSet2.Update

As was suggested by a helpful friend at TheScripts

My Access suggests I use recSet2.EditMod e instead

either way I end up with an error message

If I use recSet2.Edit then my error message is "Method or data member
not found (Error 461)"

If I use recSet2.EditMod e then my error message is "Invalid use of
Property"

but although it is the .Edit or .EditMode that get's highlighted as if I
highlighted it myself (in blue), it is the declaration of the function
that get's highlighted in yellow which is "Public Function
DaysToCompleti on() As Long" -- I have changing this to "Private Sub
DaysToCompleti on()" and that made no difference

And now for the full code (No need to read the commentary, I was adding
it to remind myself exactly what I was doing):

Option Compare Database

Public Function DaysToCompletio n() As Long

'Opening tblContracts as recSet1
Dim con1 As ADODB.Connectio n
Dim con2 As ADODB.Connectio n
Dim recSet1 As ADODB.Recordset
Dim recSet2 As ADODB.Recordset
Set con1 = CurrentProject. Connection
Set con2 = CurrentProject. Connection
Set recSet1 = New ADODB.Recordset
Set recSet2 = New ADODB.Recordset
recSet1.Open "tblContrac ts", con1
recSet2.Open "tbldtdiff" , con2
Dim x As Long

'Declaring UntilCompletion as the amount of days until completion
Dim UntilCompletion As Long

'Looping until EOF (until the last record for EndDate in
tblContracts.. .so
'someone else would have declared recSet1.Open
'"tblWhateverYo urTableNameIs", con1 which means
'connection1 and then to open a field in that recordset you type
'recSet1.Fields ("fieldname" ))
x = 0

recSet1.MoveFir st
Do Until recSet1.EOF
' End Date must be in quotes or will not work
UntilCompletion = DateDiff("d", Date, recSet1.Fields( "EndDate"))
Debug.Print UntilCompletion
recSet2.EditMod e
recSet2.Fields( "DateDifference ") = UntilCompletion
recSet2.Update
recSet1.MoveNex t
x = (x + 1)
Loop

'Clearing recSet1 and Con1 (Connection1) and recSet 2 and Con1
recSet1.Close
recSet2.Close
con1.Close
con2.Close
Set con1 = Nothing
Set con2 = Nothing
Set recSet1 = Nothing
Set recSet2 = Nothing

End Function

Any help would be much appreciated!

Cheers,

Kosmös

*** Sent via Developersdex http://www.developersdex.com ***
Dec 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2200
by: Aarono Brown | last post by:
I've seen this question asked a couple times in this forum but never answered, so I guess my hopes aren't too high, but: I'm running > mysql Ver 12.21 Distrib 4.0.14, for pc-linux (i686) on Linux with Bash and according to the documentation,
9
3661
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
0
1380
by: Lauren Wilson | last post by:
The error does not have an error number. It's not even a normal Access error message box. Hope someone has some insight to this problem. I have a form that contains a large (5" x 4") text box bound to a memo field. This field allows users to type in the text of an email to be sent through Outlook (via automation). I ONE user who send me his back end data base where he has inserted several two - three page emails. When scrolling...
0
1405
by: Kyle Blaney | last post by:
Is there a way to control how the "Edit->Advanced->Format Selection" command formats long lines? In particular, I want the command to indent long lines differently than new scope. By default, the command indents each in exactly the same way. For example, if I have my indentation level set to 3 spaces, I want code formatted as follows: if (a != b) {
0
1224
by: San Diego Guy | last post by:
Hi all! I have Datagrid. Within that datagrid I have a drop down list that I set up some values in (a "collection") I set up an edit command column on the datagrid and wrote simple code to get me in to edit mode: sub dgEdit(ByVal s As Object, ByVal e As DataGridCommandEventArgs) dgStatus.EditItemIndex = e.Item.ItemIndex bindData() 'This is just a sub I wrote to re-bind the data
2
1315
by: Nalaka | last post by:
Hi (I am using visual studio 2005 beta 2) I have a simple asp.net data grid, with a edit (update and cancel) set. When the button mode is link, it works fine. But when the button mode is image, it does not work?????? What am I doing wrong Any help is appreciated
0
6039
by: den 2005 | last post by:
Hi everybody, I am not familiar using Gridview, I created a Gridview with Edit Command Button, but when I click the update Command button this error message below is displayed, what and where is the problem? I am confused. Can anyone show me exactly to do edit process of Gridview using Edit Command button properly? Thanks. Error Message: Invalid postback or callback argument. Event validation is enabled using
2
1900
by: Parasyke | last post by:
Please help.... I have a form that I successfully add records to that I want to copy and turn into a form for editing records from that same table (It is imperitive that it be done this way, rather than just one form) ... I need in the textbox for the new edit form to have the user type in a item# then the form populates. I'm having tremedous trouble with the logic of this. Thanks!!! Dav
1
2289
by: Benny Ng | last post by:
Dear All, Now I met one problem in the development of my one application. I have one ASP.NET page. It's for disply the information of customer. But now I have one new requirement. It's to combine the "Edit" and "Display" funtions into this page. (It means if user want to edit the customer information, this page would provided editing page to the user; If the user want to display the customer information, this page would providev the...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.