Re: Updating all records in a recordset
From: Marc (mPAMpaisl_at_optusnet.com.au)
Date: 05/11/04
- Next message: John Spencer (MVP): "Re: Trimming data"
- Previous message: Jay: "Re: Record Count Inconsistent"
- In reply to: BrianC: "Updating all records in a recordset"
- Next in thread: Eric Butts [MSFT]: "RE: Updating all records in a recordset"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 12 May 2004 09:34:30 +1000
Answers inline
> The following code returns multiple records to the
> recordset. How do I update each record in the recordset
> with the value of lngNext?
>
> Set MyDb = CurrentDb
> Set qdf = MyDb.QueryDefs("QueryBlockAv")
> For Each prm In qdf.Parameters
> prm.Value = Eval(prm.Name)
> Next prm
> Set rs = qdf.OpenRecordset(dbOpenDynaset)
if rs.RecordCount = 0 then
' no records processing
goto eventExit
end if
while rs.EOF = false
> rs.Edit <== never actually used this command, not really necessary
> rs![Booking ID] = lngNext
> rs.Update
rs.MoveNext
wend
> rs.Close
> Set rs = Nothing
>
> This I believe only updates the first record. Is there a
> way of looping through each record in the set and also
> when do I know that I've got to the end?
HTH
Marc
- Next message: John Spencer (MVP): "Re: Trimming data"
- Previous message: Jay: "Re: Record Count Inconsistent"
- In reply to: BrianC: "Updating all records in a recordset"
- Next in thread: Eric Butts [MSFT]: "RE: Updating all records in a recordset"
- Messages sorted by: [ date ] [ thread ]