Form Auto Populate

  • Thread starter Thread starter PleaseHelpMe
  • Start date Start date
P

PleaseHelpMe

I hope this makes sense...

My frmEmployeeMain contains one subform, frmProbation. Within frmProbation,
there are three subforms, frmProb1, frmProb2, frmProb3. Each of these three
subforms has a CompletionDate field. These three subforms were created by
three queries from ONE table, tblProbation.

The frmEmployeeMain was created from tblEmployeeInfo. In tblEmployeeInfo and
frmEmployeeMain, there is a LastReportReceived field.

The EmployeeID is the related record in all these forms and tables.

Is it possible to automatically populate the LastReportReceived field with
the most current date entered in any of the three Prob subforms, and also
allow the LastReportReceived field to be edited?
 
You can use the after update event of each subform to set the date on the
main form.

Code the after update event of each subform would be something like this,
Me.Parent.DateControlName = Me.DateControlName

To make sure you get the most recent date, something like this:

If Not IsNull(Me.Parent.DateControlName) Then
If Me.DateControlName > Me.Parent.DateControlName Then
Me.Parent.DateControlName = Me.DateControlName
End If
Else
Me.Parent.DateControlName = Me.DateControlName
End If

Note: replace my object names with your own names.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Back
Top