PDA

View Full Version : Form - Performing a function for all records in a table



fif_rumac
06-04-2007, 06:17 AM
Hello All,

I have a continuous form which displays financial figures, notes and an date. I would like to be able to run a simple validation function when the form loads on each record within this form.

Validation Example:

If the date field is <= to date()-4 then

notes = "hello"

I have managed to get this working off of a button click for one record, however I would like the code to run automatically for all of the records. Is this possible?

Thanks

rumac

Oorang
06-04-2007, 11:20 AM
Well for display only, I would just add a conditional field to the underlying recordsource's sql.
Ex: MyNewField: iif([HireDate]<=Date(),"Hired","Future Hire")

For updating the data I would actually just use a button to call DoCmd.RunSQL and just fire off an update query. Then do a Me.Requery followed by a Me.Repaint.