Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordsets unupdatable...Why?

Status
Not open for further replies.

WhiteZiggy

Programmer
Jan 22, 2003
85
US
hello ,

I am having a problem with Access. I have a recordset. I want to convert this bad date to a good one, restore it in the recorset and then write it all to a table (create/append table).

I must just be missing something since It has been a few months from coding this, but why is saying recordet not updateable?

Function FormatDate()
Dim strSQL As String 'store SQL string to get data
Dim rsData As DAO.Recordset 'recordset of data
Dim tmpMonth As Variant
Dim tmpDay As String
Dim tmpYear As String
Dim tmpNewDate As Date

strSQL = "SELECT ODDGL FROM RADPRODTA"
Set rsData = CurrentDb.OpenRecordset(strSQL) 'get recordset

Do While rsData.EOF = False
'converts year if century one or 0
If Left(rsData("ODDGL"), 1) = 1 Then
tmpYear = "20" & Mid(rsData("ODDGL"), 2, 2)
ElseIf Left(rsData("ODDGL"), 1) = 0 Then
tmpYear = "19" & Mid(rsData("ODDGL"), 2, 2)
End If
tmpYear = "12/31/" & tmpYear

tmpNewDate = CDate(tmpYear) + Right(rsData("ODDGL"), 3)


'THIS IS WHERE IT BREAKS ''''
rsData.Edit
rsData!ODDGL = tmpNewDate
rsData.Update


rsData2.MoveNext
Loop
end sub


It says the object is read only. Why? I have tried MANY things, even changing it to ADO..

Any suggestions?

Thanks,
WZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top