needs Maximum Date

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

In the subform user enters the dates. I need help when he is done with
enteries of multiple rows program check the dates and the date which is
max shows into another textbox name maxdate which is in the main form,
separate from the subform.

Thanks,
 
This will work the same as bringing a total from a subform to the main form.
you need to put a textbox (Let's call it MaxDateCalc) in the footer of the
subform to do the calculation of maxdate and then add a textbox to the main
form that has a datasource of the MaxDateCalc textbox in the subform.

The following is a copy-paste from the help files.....

Min, Max Functions
Return the minimum or maximum of a set of values contained in a specified
field on a query.

Syntax
Min(expr)

Max(expr)

The expr placeholder represents a string expression identifying the field
that contains the data you want to evaluate or an expression that performs a
calculation using the data in that field. Operands in expr can include the
name of a table field, a constant, or a function (which can be either
intrinsic or user-defined but not one of the other SQL aggregate functions).

------------------------------------

So it all boils down to the design of these dates. If you are using a
datsheet view and the dates all are in the same field of different records,
this would be easy. If you have dates spread out among various fields in the
same record, it becomes more complex but can still be done.

That's just my opinion, I could be wrong!
 
Eric,

Here's a way to do it that doesn't require code:

I'll use the folling names in this example. Adjust these to fit your
application.
Subform object name = MySubform
Date field name = MyDate

Create a control on the subform and set it's name to txtMaxDateSub.
I would put this control in the header or footer section. You can set
the Visible property of the section or the text box to No if you don't
want them to show.

Put the following as the Control Source for txtMaxDateSub: =Max(MyDate)
This will display the maximum date you want, but in the subform (If it
is OK so show it in the subform, you're done).

In the main form, create a textbox named txtMaxDateMain.
Put the following as the Control Source for txtMaxDateMain:
=MySubform.Form!txtMaxDateSub
This will display in the main form the max date value from the subform

Jerry
 

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

Back
Top