Can't update a table.

dz2k7

Not only User
Local time
Today, 07:30
Joined
Apr 19, 2007
Messages
104
Hi everybody,

I use regular connection and recordset.
By some reasons I can't change the record in a table.

I do:

rs.Fields(Field).Value = number
rs.Update

When run got the message
Run-time error '3265'
Item cannot be found in collection corresponding to the requested name or ordinal.

Help does not show anything.

I checked the name of the field - it's fine.

Any idea? Please.
 
Can't find anything ueful there.... Sorry
 
What is the ACTUAL code you are using, not some made up part?

This is not valid code:

rs.Fields(Field).Value = number


So what is it you are REALLY using?

It would also help if you post the entire function or sub.
 
And use the code tags around the code so it retains its formatting.

This is how to use code tags here on the forum:

codetag001.png
 
OK
what i'm trying to do is the only little thing
I need to fill up the emty column in a table.
It should have cumulative numbers made up of the column next to this one like

------------------------------
! Lines ! CumuateLines !
-----------------------------
! 100 ! 100 !
! 50 ! 150 !

So i did this

Code:
Public Function CumulativeNumbers()
 
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
Set cnn = CurrentProject.Connection
rs.ActiveConnection = cnn
 
cumul = 0
 
    rs.Open "SELECT * FROM Temp1"
    rs.MoveFirst
 
    While Not rs.EOF()
 
        cumul = cumul + rs!Lines
        rs.Fields(CumulateLines).Value = cumul
        rs.Update
        rs.MoveNext
 
    Wend
 
rs.Close
Set rs = Nothing
 
cnn.Close
Set cnn = Nothing
End Function
 
Okay that helps.

Change this line to add quotes (in red):

rs.Fields("CumulateLines").Value = cumul
 
i did before
same thing

So make sure that you've spelled the field name correctly in the code. The error message is telling you that it can't find the field named CumulateLines in the recordset. So double check that the field name is spelled exactly the same.
 
Did 100 times
Swr to got!
Just getting creasy.
 
Of course you could open the Temp1 table and find out which number the column you want is in the order. So the first field is 0, second is 1, third is 2, etc. and then use

rs.Fields(x).Value = cumul

where x is the actual zero-based number of the column. So if it is the 4th column in the table you would use

rs.Fields(3).Value = cumul

or just

rs(3).Value = cumul
 
How do i post the DB?

2007 -

1. Go to the Big Round Office Button

2. Click MANAGE

3. Click Compact and Repair

4. Go to the file location of your accdb file

5. Right click on the accdb file

6. Select SEND TO > COMPRESSED FOLDER


2000 to 2003 -

1. Click TOOLS > DATABASE UTILITIES > COMPACT AND REPAIR

2. Go to the file location of your mdb file.

3. Right click on the mdb file

4. Select SEND TO > COMPRESSED FOLDER


Then when you see the quick reply area on the forum here (where you type in a quick reply) you just click the GO ADVANCED button

Then go down near the bottom of the page to find the MANAGE ATTACHMENTS button.

Next you click that button and a dialog opens up. Browse to your file and click UPLOAD. When done click the close link on the dialog and then type in anything in the message area (10 characters minimum) and then click the button to post the response.
 
It's 10th column

Tyred both

rs.Fields(10).Value = cumul

rs(10).Value = cumul

same thing
 

Users who are viewing this thread

Back
Top Bottom