Update a date on main Form

G

Guest

I have a datasheet subform that has [Receiveddate] column that has several
dates in it and a combobox that has [status]. What I would ike to do is
update a textbox on the main form with the latest date in the [Receiveddate]
column from the subform if status is not equal to pending.

E.g., Status ReceivedDate
Complete 12/25/05
Complete 12/25/05
complete 12/29/05

So the date I would ike to have on mainform is 12/29/05
 
G

Guest

I am assuming this is a continuous form.
An easy way to do this would be to add a textbox with the control source:
=iif([Status] <> "pending",[Receiveddate],"")
then in the forms footer place the textbox with the control source:
=max([Textbox]) where [Textbox] is the control created above

I have not tested this so it may take a little tweaking. Hide the first
textbox you created. If my assumtion is wrong, you will have to take a
different approach.
 
G

Guest

Thanks for the response, however, the response worked partially. The subform
is a continous form, some records could have pending and some could have
Completed or cancelled, so what its doing is that the for the record that has
the mixed status, its still putting the max date, so how will take care of
this?

schasteen said:
I am assuming this is a continuous form.
An easy way to do this would be to add a textbox with the control source:
=iif([Status] <> "pending",[Receiveddate],"")
then in the forms footer place the textbox with the control source:
=max([Textbox]) where [Textbox] is the control created above

I have not tested this so it may take a little tweaking. Hide the first
textbox you created. If my assumtion is wrong, you will have to take a
different approach.

JOM said:
I have a datasheet subform that has [Receiveddate] column that has several
dates in it and a combobox that has [status]. What I would ike to do is
update a textbox on the main form with the latest date in the [Receiveddate]
column from the subform if status is not equal to pending.

E.g., Status ReceivedDate
Complete 12/25/05
Complete 12/25/05
complete 12/29/05

So the date I would ike to have on mainform is 12/29/05
 

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

Similar Threads

How do I get the DMax(Date) 1
subform infor on main form! 1
Main Sheet 6
form or query 1
Text to Date Conversion 2
Form 25
date field on forms 1
Problem with new entry on tabbed forms 2

Top