WhiteZiggy
Programmer
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
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"
tmpYear = "20" & Mid(rsData("ODDGL"
ElseIf Left(rsData("ODDGL"
tmpYear = "19" & Mid(rsData("ODDGL"
End If
tmpYear = "12/31/" & tmpYear
tmpNewDate = CDate(tmpYear) + Right(rsData("ODDGL"
'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