Friday, 15 April 2011

ms access - loop updates table but also gets system exceeds resources error -


I am running a loop down in a macro. This table has finished updating but I always get a "more than system resources" ... I was wondering what could be wrong ...

Or is there a better way of doing this ... <(first! AvgOfT1_discount)> Moderate first DAO.Recordset set first = CurrentDb.OpenRecordset ("temp_group") as rst.EmoveFirst Do as rst.EOF then ISNull then first rst .Edit! AvgOfT1_discount = 0 rst.Update termination if If IsNull (rst! AvgOfT2_discount) then rst.Edit rst! AvgOfT2_discount = 0 rst.Update End if if IsNull (RST! AvgOfT3_discount) then rst.Edit rst! AvgOfT3_discount = 0 rst.Update End If If IsNull (rst! AvgOfT4_discount) then first rst.Edit! AvgOfT4_discount = 0 rst.Update end then rst.MoveNext loop set is first = nothing

< P> This should work with any error, although only once to copy per record can be simplified like this:

  The first as the first DAO.Recordset set is the first = CurrentDb.OpenRecordse t ("temp_group") rst.MoveFirst until rst.EOF if it isnl (rst! AvgOfT1_discount.Value + rst! AvgOfT2_discount.Value + rst! AvgOfT3_discount.Value + rst! AvgOfT4_discount.Value) then rst.Edit IsNull (rst! AvgOfT1_discount.Value) If RAT! AvgOfT1_discount.Value = 0 Closing if IfNull (RST! AvgOfT2_discount.Value) then RST! AvgOfT2_discount.Value = 0 Closing if if IsNull (RST! AvgOfT3_discount.Value) then RST! AvgOfT3_discount.Value = 0, then IsNull (first! AvgOfT4_discount.Value) followed by the first! AvgOfT4_discount.Value = 0 end then rst.Update end then rst.MoveNext loop set first = nothing  

No comments:

Post a Comment