Foote, Chris
Chris.Foote at uk.thalesgroup.com
Fri Oct 24 06:33:10 CDT 2003
Cheers Andy! With help from Stuart Sanders this is (more or less) what I have come with. But I had forgotten about setting the recordsets to "Nothing" which I will change straight away! Thanks for your help! Chris Foote > -----Original Message----- > From: Andy Lacey [mailto:andy at minstersystems.co.uk] > Sent: Friday, October 24, 2003 12:23 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] MoveNext not working > > > Chris > You need to use two recordsets. Each time you reopen the > "input" recordset > the pointer is repositioned so MoveNext isn't going to the > right record. Try > the following: > > Option Compare Database > Option Explicit > > Private Sub Command0_Click() > > Dim db As Database > Dim recIn As Recordset > Dim RecOut as Recordset > Dim strECR As String > > Set db = CurrentDb() > > '------------------------------- > 'Write first line to output table > '-------------------------------- > Set recOut = db.OpenRecordset("tblScript") > > recOut.AddNew > > recOut("fldScript") = "set db pdm" > > recOut.Update > > '------------------------------- > 'Open tblOutstandingECRs and move to first record > '------------------------------- > > Set recIn = db.OpenRecordset("tblOutstandingECRs") > > recIn.MoveFirst > > ' Do until end of file > Do Until recIn.EOF > > strECR = recIn("ECR_No") > > recOut.AddNew > > recOut("fldScript") = "set record ecr\" & strECR & "\1 /var=%oldset1" > > recOut.Update > > recIn.MoveNext > > Loop > > '------------------------------- > 'Write last line to output table > '-------------------------------- > recOut.AddNew > > recOut("fldScript") = "list record %oldset1 recname,reclevel recn" > > recOut.Update > > recIn.Close:set recIn=Nothing > recOut.Close:set recOut=Nothing > End Sub > > > -- > Andy Lacey > http://www.minstersystems.co.uk > > > --------- Original Message -------- > From: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > To: "'Access Developers discussion and problem solving'" > <accessd at databaseadvisors.com> > Subject: [AccessD] MoveNext not working > Date: 24/10/03 09:22 > > > Good morning all! > > Can anyone please see what I've doing wrong in the code below? ----------(Original post snipped)---------