Recordset Not Updating

poet1234

Registered User.
Local time
Today, 11:50
Joined
Oct 7, 2004
Messages
46
Hello. I am having a problem looping through a recordset and having it update. As a matter of fact, only the first record in the recordset is being updated. I am certian it has to do with the way I am looping. Here is a snipit of my code:

rsMOE.Open "select * from MonthExecutionQ where EP_ID = " & Me.EP_ID & " and BLI is not null", cnn adOpenKeyset, adLockOptimistic, adCmdTableDirect

Do While Not rsMOE.EOF
rsBLI.Open "select * from BLI where BLI = '" & rsMOE!BLI & " ' ", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
rsBLI!JanSpend = rsMOE!SumOfJanSpend
rsBLI.Update
rsBLI.MoveNext
rsMOE.MoveNext
rsBLI.Close
Loop

What am I doing wrong?
 
Try Replacing & " ' " With & "'" that is if it's a string I don't use ADO A lot but can't see anything else but never used the rsBLI.Open In a loop before.

mick
 
Poet,

rsBLI.Open "select * from BLI where BLI = '" & rsMOE!BLI & " ' ", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect

rsBLI.Edit ' <-- Add this line

rsBLI!JanSpend = rsMOE!SumOfJanSpend
rsBLI.Update

hth,
Wayne
 

Users who are viewing this thread

Back
Top Bottom