Add

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

Guest

Hi,

I'd like to add the following functionality to one of my forms: when the
field "status" changes to "closed", another field called "closed on" should
populate the système date.

I tried to add the following formula in the control source of the "closed
on" field:
=IIf([Status]="Closed",Now(),"")

But of course it refreshes the date everytime I reopen the form and I don't
want that. So I tried to add the following formula to the after update part
of the "status" field but the "status" filed stays blank.
=IIf([Status]="Closed",[Closed On]=Now(),"")

If anyone has succeeded in doing something similar, I would really
appreciate if you could share with me your experience.

Thanks a lot,
 
Hi Kanga,

you should forget about storing the checkbox value -- just
use the Closed date and if it is null, then the project is
still open.

To make it easy, you can assign the double-click event of
the Closed date to this:

me.dateclosed_controlname = Date()

Personally, I assign a popup calendar to launch on the
double-click event of all dates and it defaults to today's date.

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
Your code belongs in the AfterUpdate event of the control containing
status.

If this control = "Closed" then That control=Now()

HTH
 
Hi Larry,

Indeed, I have tried the following in the afterupdate event but with no luck:
If Me.Status= "Closed" Then Me.Closed_On = Now() Else Closed_On = Null

I'm pretty sure this is due to the fact that my "status" field has some
logic in the data control source. In fact, my status field will change to
"Closed" based on some criteria that I have predefined.

So the user fill out the form and depending on some options he chooses the
status changes to "closed". But my guess is that it is not recording that as
a change until I leave the form.

On the other hand, the logic above works if I use it with a field that is
directly populated by the user...

Do you see what I mean?

Thanks!
Géraldine


So it looks like access doesn't consider that as an update.


Larry Daugherty said:
Your code belongs in the AfterUpdate event of the control containing
status.

If this control = "Closed" then That control=Now()

HTH
--
-Larry-
--

Kanga said:
Hi,

I'd like to add the following functionality to one of my forms: when the
field "status" changes to "closed", another field called "closed on" should
populate the système date.

I tried to add the following formula in the control source of the "closed
on" field:
=IIf([Status]="Closed",Now(),"")

But of course it refreshes the date everytime I reopen the form and I don't
want that. So I tried to add the following formula to the after update part
of the "status" field but the "status" filed stays blank.
=IIf([Status]="Closed",[Closed On]=Now(),"")

If anyone has succeeded in doing something similar, I would really
appreciate if you could share with me your experience.

Thanks a lot,
 
Hi Géraldine,

That would be the AfterUpdate event of the CONTROL -- if you
are using form events, it would not go in AfterUpdate, but
in BeforeUpdate

.... but it sounds like you may not need a Status field as
that is a calculated value... you should not store
calculations. If the user needs to be able to change
"status" then you may wish to store it. After you make an
assignment to it, do this to see the change right away

DoEvents

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Hi Larry,

Indeed, I have tried the following in the afterupdate event but with no luck:
If Me.Status= "Closed" Then Me.Closed_On = Now() Else Closed_On = Null

I'm pretty sure this is due to the fact that my "status" field has some
logic in the data control source. In fact, my status field will change to
"Closed" based on some criteria that I have predefined.

So the user fill out the form and depending on some options he chooses the
status changes to "closed". But my guess is that it is not recording that as
a change until I leave the form.

On the other hand, the logic above works if I use it with a field that is
directly populated by the user...

Do you see what I mean?

Thanks!
Géraldine


So it looks like access doesn't consider that as an update.


:

Your code belongs in the AfterUpdate event of the control containing
status.

If this control = "Closed" then That control=Now()

HTH
--
-Larry-
--

Hi,

I'd like to add the following functionality to one of my forms: when
the

field "status" changes to "closed", another field called "closed on"
should

populate the système date.

I tried to add the following formula in the control source of the
"closed

on" field:
=IIf([Status]="Closed",Now(),"")

But of course it refreshes the date everytime I reopen the form and

I don't
want that. So I tried to add the following formula to the after

update part
of the "status" field but the "status" filed stays blank.
=IIf([Status]="Closed",[Closed On]=Now(),"")

If anyone has succeeded in doing something similar, I would really
appreciate if you could share with me your experience.

Thanks a lot,
 
Hi,

I'm not sure I understand what you mean.

For different reasons, I need the status field. The user should not manually
update it though. It is populated based on some logic in the control source.

The user fills in the form. If all criteria are met the status changes to
"Closed".
And I would just like the "Closed On" field to populate the current date if
the status field changes to "Closed".

Why does it not work to have an after update event on the Status field?

Thanks a lot for trying to help.





strive4peace said:
Hi Géraldine,

That would be the AfterUpdate event of the CONTROL -- if you
are using form events, it would not go in AfterUpdate, but
in BeforeUpdate

.... but it sounds like you may not need a Status field as
that is a calculated value... you should not store
calculations. If the user needs to be able to change
"status" then you may wish to store it. After you make an
assignment to it, do this to see the change right away

DoEvents

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Hi Larry,

Indeed, I have tried the following in the afterupdate event but with no luck:
If Me.Status= "Closed" Then Me.Closed_On = Now() Else Closed_On = Null

I'm pretty sure this is due to the fact that my "status" field has some
logic in the data control source. In fact, my status field will change to
"Closed" based on some criteria that I have predefined.

So the user fill out the form and depending on some options he chooses the
status changes to "closed". But my guess is that it is not recording that as
a change until I leave the form.

On the other hand, the logic above works if I use it with a field that is
directly populated by the user...

Do you see what I mean?

Thanks!
Géraldine


So it looks like access doesn't consider that as an update.


:

Your code belongs in the AfterUpdate event of the control containing
status.

If this control = "Closed" then That control=Now()

HTH
--
-Larry-
--


Hi,

I'd like to add the following functionality to one of my forms: when

the

field "status" changes to "closed", another field called "closed on"

should

populate the système date.

I tried to add the following formula in the control source of the

"closed

on" field:
=IIf([Status]="Closed",Now(),"")

But of course it refreshes the date everytime I reopen the form and

I don't

want that. So I tried to add the following formula to the after

update part

of the "status" field but the "status" filed stays blank.
=IIf([Status]="Closed",[Closed On]=Now(),"")

If anyone has succeeded in doing something similar, I would really
appreciate if you could share with me your experience.

Thanks a lot,
 
Maybe is IS updating, you are just not seeing the change
right away. If you move away from that record and come
back, is the change there?

If so, after you make the assignment, use this statement to
make the change show immediately

DoEvents

If that doesn't do it, you might putting the in the
BeforeUpdate event...

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Hi,

I'm not sure I understand what you mean.

For different reasons, I need the status field. The user should not manually
update it though. It is populated based on some logic in the control source.

The user fills in the form. If all criteria are met the status changes to
"Closed".
And I would just like the "Closed On" field to populate the current date if
the status field changes to "Closed".

Why does it not work to have an after update event on the Status field?

Thanks a lot for trying to help.





:

Hi Géraldine,

That would be the AfterUpdate event of the CONTROL -- if you
are using form events, it would not go in AfterUpdate, but
in BeforeUpdate

.... but it sounds like you may not need a Status field as
that is a calculated value... you should not store
calculations. If the user needs to be able to change
"status" then you may wish to store it. After you make an
assignment to it, do this to see the change right away

DoEvents

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com


Hi Larry,

Indeed, I have tried the following in the afterupdate event but with no luck:
If Me.Status= "Closed" Then Me.Closed_On = Now() Else Closed_On = Null

I'm pretty sure this is due to the fact that my "status" field has some
logic in the data control source. In fact, my status field will change to
"Closed" based on some criteria that I have predefined.

So the user fill out the form and depending on some options he chooses the
status changes to "closed". But my guess is that it is not recording that as
a change until I leave the form.

On the other hand, the logic above works if I use it with a field that is
directly populated by the user...

Do you see what I mean?

Thanks!
Géraldine


So it looks like access doesn't consider that as an update.


:



Your code belongs in the AfterUpdate event of the control containing
status.

If this control = "Closed" then That control=Now()

HTH
--
-Larry-
--



Hi,

I'd like to add the following functionality to one of my forms: when

the


field "status" changes to "closed", another field called "closed on"

should


populate the système date.

I tried to add the following formula in the control source of the

"closed


on" field:
=IIf([Status]="Closed",Now(),"")

But of course it refreshes the date everytime I reopen the form and

I don't


want that. So I tried to add the following formula to the after

update part


of the "status" field but the "status" filed stays blank.
=IIf([Status]="Closed",[Closed On]=Now(),"")

If anyone has succeeded in doing something similar, I would really
appreciate if you could share with me your experience.

Thanks a lot,
 
Back
Top