air1access
Technical User
I am stumped..
I have to recordsets (RS). One is a base and the other is a varying RS. The example below does just fine for adding a new record to the base RS or editing a record in the base RS. But what I can't figure is how to delete a record from the base RS when that matching record is NOT in the varying RS. The varying RS recordcount changes all the time - so when there is more records in the varying RS - they need to be added to the base RS, when there is less - they need to be deleted from the base RS, and when there is a match - they need to be edited...
Any examples or suggestions as to how I can get the code posted below to "make it happen"...?? I sure to appreciate it and thank ya in advance...!!!
Regards - air1access
My example -
rstVarying.MoveFirst
Do Until rstVarying.EOF = True
rstBase.FindFirst "[IID] = '" & rstVarying!IID & "'"
If rstBase.NoMatch Then
rstBase.AddNew
rstBase!GTWY = GBLGTWY
rstBase!FLEETTYPE = GBLFleet
rstBase!IID = rstVarying!IID
rstBase!FleetEff = rstVarying!FLEETTYPE
rstBase.Update
Else
rstBase.Edit
rstBase!GTWY = GBLGTWY
rstBase!FLEETTYPE = GBLFleet
rstBase!IID = rstVarying!IID
rstBase!FleetEff = rstVarying!FLEETTYPE
rstBase.Update
End If
rstVarying.MoveNext
Loop
I have to recordsets (RS). One is a base and the other is a varying RS. The example below does just fine for adding a new record to the base RS or editing a record in the base RS. But what I can't figure is how to delete a record from the base RS when that matching record is NOT in the varying RS. The varying RS recordcount changes all the time - so when there is more records in the varying RS - they need to be added to the base RS, when there is less - they need to be deleted from the base RS, and when there is a match - they need to be edited...
Any examples or suggestions as to how I can get the code posted below to "make it happen"...?? I sure to appreciate it and thank ya in advance...!!!
Regards - air1access
My example -
rstVarying.MoveFirst
Do Until rstVarying.EOF = True
rstBase.FindFirst "[IID] = '" & rstVarying!IID & "'"
If rstBase.NoMatch Then
rstBase.AddNew
rstBase!GTWY = GBLGTWY
rstBase!FLEETTYPE = GBLFleet
rstBase!IID = rstVarying!IID
rstBase!FleetEff = rstVarying!FLEETTYPE
rstBase.Update
Else
rstBase.Edit
rstBase!GTWY = GBLGTWY
rstBase!FLEETTYPE = GBLFleet
rstBase!IID = rstVarying!IID
rstBase!FleetEff = rstVarying!FLEETTYPE
rstBase.Update
End If
rstVarying.MoveNext
Loop