do until

  • Thread starter Thread starter newkid
  • Start date Start date
N

newkid

Hi everyone,
I have a table called ACH that I search for a customer id and find out
if that customer has passthru, upload or application. Each customer
can have both passthru and application. If they have both, they will
be in seperate records.The customer table has two fields. One for
Passthru and one for application. If pasthru or upload is located, I
open the Customer table and mark the passthru or application TRUE.

Here's the problem. I'm using findnext customer id as my search within
a loop. So of course I'm getting locked in an infinate loop.

Could someone help me get out of the infinite loop or I'm open to a
completely new way of locating the records in the ach table.

With rsACH
.MoveFirst
.FindFirst "[Customer ID] = " & lngCustomer & ""

Do Until rsACH.EOF = True

If rsACH![UploadOrApp] = "PassThru" Or rsACH!
[UploadOrApp] = "Upload" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH File Upload] = True
.Update
End With

Else

If rsACH![UploadOrApp] = "Application" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH Application] = True
.Update
End With

End If
End If

rsACH.FindNext "[Customer ID] = " & lngCustomer & ""

Loop
End With

rsACH.Close
rsCustomer.Close


Thank all!
 
I know you know this one. You have to put a rs.movenext in your code so the
loop can go to the next record otherwise it keeps looping through the first
record.

hth
 
I know you know this one. You have to put a rs.movenext in your code so the
loop can go to the next record otherwise it keeps looping through the first
record.

hth
--
Maurice Ausum



newkid said:
Hi everyone,
I have a table called ACH that I search for a customer id and find out
if that customer has passthru, upload or application. Each customer
can have both passthru and application. If they have both, they will
be in seperate records.The customer table has two fields. One for
Passthru and one for application. If pasthru or upload is located, I
open the Customer table and mark the passthru or application TRUE.
Here's the problem. I'm using findnext customer id as my search within
a loop. So of course I'm getting locked in an infinate loop.
Could someone help me get out of the infinite loop or I'm open to a
completely new way of locating the records in the ach table.
With rsACH
.MoveFirst
.FindFirst "[Customer ID] = " & lngCustomer & ""
DoUntilrsACH.EOF = True
If rsACH![UploadOrApp] = "PassThru" Or rsACH!
[UploadOrApp] = "Upload" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH File Upload] = True
.Update
End With

If rsACH![UploadOrApp] = "Application" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH Application] = True
.Update
End With
End If
End If
rsACH.FindNext "[Customer ID] = " & lngCustomer & ""
Loop
End With

Thank all!- Hide quoted text -

- Show quoted text -

Thanks for the reply Maurice,
You're right, I do know I need .movenext but I'm not sure where to put
it since I have the .findfirst.
Thanks
 
You're right, I do know I need .movenext but I'm not sure where to put
it since I have the .findfirst.

Right before the Loop statement.

John W. Vinson [MVP]
 
Right before the Loop statement.

John W. Vinson [MVP]

I tried it there, but it still puts me in the never ending loop. When
I put it at the end it tells me no record found. Thanks so much for
your help. Here's what I tried.

With rsACH
.MoveFirst
.FindFirst "[Customer ID] = " & lngCustomer & ""
rsACH.MoveNext
Do Until rsACH.EOF = True

If rsACH![UploadOrApp] = "PassThru" Or rsACH![UploadOrApp]
= "Upload" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH File Upload] = True
.Update
End With

End If

rsACH.FindNext "[Customer ID] = " & lngCustomer & ""
Loop
End With

rsACH.Close
rsCustomer.Close
Set rsACH = Nothing
Set rsCustomer = Nothing
 
Right before the Loop statement.
John W. Vinson [MVP]

I tried it there, but it still puts me in the never ending loop. When
I put it at the end it tells me no record found. Thanks so much for
your help. Here's what I tried.

With rsACH
.MoveFirst
.FindFirst "[Customer ID] = " & lngCustomer & ""
rsACH.MoveNext
Do Until rsACH.EOF = True

If rsACH![UploadOrApp] = "PassThru" Or rsACH![UploadOrApp]
= "Upload" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH File Upload] = True
.Update
End With

End If

rsACH.FindNext "[Customer ID] = " & lngCustomer & ""
Loop
End With

rsACH.Close
rsCustomer.Close
Set rsACH = Nothing
Set rsCustomer = Nothing

I got it. In case anyone else needs to use this here it is
Thanks for the help John and Maurice.

With rsACH
.MoveFirst
.FindFirst "[Customer ID] = " & lngCustomer & ""

Do Until rsACH.EOF = True
If rsACH![UploadOrApp] = "PassThru" Or rsACH![UploadOrApp]
= "Upload" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH File Upload] = True
.Update
End With

End If

'****************
If rsACH![UploadOrApp] = "Application" Then
Set rsCustomer = dbType.OpenRecordset("Customer",
dbOpenDynaset, dbSeeChanges)
With rsCustomer
.FindFirst "[Customer ID] = " & lngCustomer & ""
.Edit
![ACH Application] = True
.Update
End With

End If
'********************
rsACH.MoveNext
If rsACH.EOF = True Then
Exit Do
End If
rsACH.FindNext "[Customer ID] = " & lngCustomer & ""
Loop
End With


rsACH.Close
rsCustomer.Close
Set rsACH = Nothing
Set rsCustomer = Nothing
 
Back
Top