go through the records in a form from code

  • Thread starter aceavl via AccessMonster.com
  • Start date
A

aceavl via AccessMonster.com

i have a table tblPay for Payments and a tblEmp for employees (i have a lot
more but this are the ones involved in my problem) when i go through the
records in the form for employees it auto fills a yes/no field to know wich
ones are overdue in their payments, based on tha tblPay, this works fine
except that it doesn't get filled UNTILL i go through the records 1 by 1 with
the form, if i add a new payment and open the table Employees it doesn't
shows it, i have another form where i need to use that yes/no field so i need
a way to open the frmEmp and make it go through all the records and then
close so its updated and i can use it, any ideas on how to do it from code?
 
M

Michel Walsh

Can't you run a query update before opening your recordset?


DoCmd.RunSQL "UPDATE tableName SET booleanField = -1 WHERE
PaymendDueDate < Today() "


That updates all your records, in a single statement, in a single 'batch'.
Sure, you have to check the "where" clause to see if it fits your need.



Hoping it may help,
Vanderghast, Access MVP
 
A

aceavl via AccessMonster.com

thanks for your help! i'll try doing what you suggested!!

Michel said:
Can't you run a query update before opening your recordset?

DoCmd.RunSQL "UPDATE tableName SET booleanField = -1 WHERE
PaymendDueDate < Today() "

That updates all your records, in a single statement, in a single 'batch'.
Sure, you have to check the "where" clause to see if it fits your need.

Hoping it may help,
Vanderghast, Access MVP
i have a table tblPay for Payments and a tblEmp for employees (i have a lot
more but this are the ones involved in my problem) when i go through the
[quoted text clipped - 9 lines]
close so its updated and i can use it, any ideas on how to do it from
code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top