need to update another open form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can you tell me how to write code for the following;
after update
While I am in frmRepairs and frmCustomerEquipment is also open.
I have a checkBox field to indicate if this is a "preventative maintenance"
(named "PM") type of repair.
and I have a DateCompleted field.

if PM= true and DateCompleted is not null then
update the field in frmCustomerEquipment called LastPMDate with the
date in frmRepairs, DateCompleted

frmCustomerEquipment is open and we have a button to go to
frmRepairs.

Appreciate your help, KPE
 
Hi KPE,

A better approach in a relational database is not to store LastPMDate at
all, but instead look it up whenever needed. That way you're never
storing two separate pieces of data that refer to the same real-world
fact - with the possibility this offers for them getting out of sync).

So I wouldn't use a LastPMDate field at all in the table on which
frmCustomerEquipment is based. Instead, I'd have a textbox txtLastPMDate
on the form, with an expression in it like this:

=DMAX("DateCompleted", "Repairs", "(EquipmentID=" & [EquipmentID] & ")
AND (PM=True)")

Obviously you need to replace EquipmentID with the name of the actual
field that relates Repairs to Equipment.
 
Back
Top