R
Richard
This is the wierdest thing. If I try to Add a new record, I can't loop through the recordset. It only goes through once. If I try to delete a records, I get a runtime error. Yet, I have verified that the recordset supports both these methods (AddNew and Delete). If I simply loop through, printing dummy statements, it works fine, going through all the records. Any ideas what's going on? (Code follows below
Richar
====================
Dim myRecordSet, myRecordSetNew As ADODB.Recordse
Set myRecordSet = New ADODB.Recordse
Dim strSQL As Strin
strSQL = "SELECT chorizon.hzname, chorizon.hzdepb_r, " &
"chorizon.sandtotal_r, chorizon.silttotal_r, " &
"chorizon.claytotal_r, chorizon.ksat_r, chorizon.awc_r, " &
"chorizon.wtenthbar_r, chorizon.wthirdbar_r, " &
"chorizon.wfifteenbar_r, chorizon.wsatiated_r, " &
"chorizon.chkey, chtexturegrp.texture, " &
"chtexturegrp.stratextsflag, chtexturegrp.rvindicator, " &
"chtexturegrp.chtgkey, component.comppct_r, component.compname, " &
"component.compkind, component.majcompflag, component.cokey, " &
"mapunit.musym, mapunit.muname, mapunit.mukind, mapunit.muacres, " &
"mapunit.mukey " &
"FROM (mapunit INNER JOIN (component INNER JOIN chorizon " &
"ON component.cokey = chorizon.cokey) " &
"ON mapunit.mukey = component.mukey) INNER JOIN chtexturegrp " &
"ON chorizon.chkey = chtexturegrp.chkey
myRecordSet.Open strSQL, CurrentProject.Connection, adOpenStatic,
adLockOptimistic, adCmdTex
'Supports querie
If myRecordSet.Supports(adDelete) The
Debug.Print "Supports Delete
Els
Debug.Print "Doesn't Support Delete
End I
If myRecordSet.Supports(adAddNew) The
Debug.Print "Supports AddNew
Els
Debug.Print "Doesn't Support AddNew
End I
If myRecordSet.Supports(adFind) The
Debug.Print "Supports Find
Els
Debug.Print "Doesn't Support Find
End I
If myRecordSet.Supports(adIndex) The
Debug.Print "Supports Index
Els
Debug.Print "Doesn't Support Index
End I
On Error GoTo HandleError
With myRecordSe
.MoveFirs
D
.Delet
'AddNe
Debug.Print "I am here
'.Updat
.MoveNex
Loop Until .EO
Debug.Print .RecordCoun
End Wit
Exit Su
Richar
====================
Dim myRecordSet, myRecordSetNew As ADODB.Recordse
Set myRecordSet = New ADODB.Recordse
Dim strSQL As Strin
strSQL = "SELECT chorizon.hzname, chorizon.hzdepb_r, " &
"chorizon.sandtotal_r, chorizon.silttotal_r, " &
"chorizon.claytotal_r, chorizon.ksat_r, chorizon.awc_r, " &
"chorizon.wtenthbar_r, chorizon.wthirdbar_r, " &
"chorizon.wfifteenbar_r, chorizon.wsatiated_r, " &
"chorizon.chkey, chtexturegrp.texture, " &
"chtexturegrp.stratextsflag, chtexturegrp.rvindicator, " &
"chtexturegrp.chtgkey, component.comppct_r, component.compname, " &
"component.compkind, component.majcompflag, component.cokey, " &
"mapunit.musym, mapunit.muname, mapunit.mukind, mapunit.muacres, " &
"mapunit.mukey " &
"FROM (mapunit INNER JOIN (component INNER JOIN chorizon " &
"ON component.cokey = chorizon.cokey) " &
"ON mapunit.mukey = component.mukey) INNER JOIN chtexturegrp " &
"ON chorizon.chkey = chtexturegrp.chkey
myRecordSet.Open strSQL, CurrentProject.Connection, adOpenStatic,
adLockOptimistic, adCmdTex
'Supports querie
If myRecordSet.Supports(adDelete) The
Debug.Print "Supports Delete
Els
Debug.Print "Doesn't Support Delete
End I
If myRecordSet.Supports(adAddNew) The
Debug.Print "Supports AddNew
Els
Debug.Print "Doesn't Support AddNew
End I
If myRecordSet.Supports(adFind) The
Debug.Print "Supports Find
Els
Debug.Print "Doesn't Support Find
End I
If myRecordSet.Supports(adIndex) The
Debug.Print "Supports Index
Els
Debug.Print "Doesn't Support Index
End I
On Error GoTo HandleError
With myRecordSe
.MoveFirs
D
.Delet
'AddNe
Debug.Print "I am here
'.Updat
.MoveNex
Loop Until .EO
Debug.Print .RecordCoun
End Wit
Exit Su