G
Guest
How do I allow users to change a calculated date in a form field?
Allen Browne said:If you need to allow users to change the value in a field, you need to store
it.
Use the AfterUpdate event of the control(s) its value is based on to assign
the inital value. The users can then change it as needed.
For example, if your invoice is normally due 14 days from the InvoiceDate,
but a user can change to to 30 days or something else, you would use this in
the AfterUpdate event procedure of InvoiceDate:
Private Sub InvoiceDate_AfterUpdate()
Me.DueDate = DateAdd("d", 14, Me.InvoiceDate)
End Sub
More info in article:
Calculated Fields
at:
http://allenbrowne.com/casu-14.html
Allen Browne said:When you set the After Update property to:
[Event Procedure]
and then click the Build button (...) beside the property, Access opens the
code window.
In that context, you can use Me. to refer to the form that this module
belongs to. For example, if the form was named Form1, then Me is equivalent
to:
Forms![Form1]
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
jdasnoit said:Allen,
Thanks for your reply...what is the Me.?
jdasnoit said:Thanks Allen...that was very helpful! I really appreciate your assistance
on
this, as it's been a while since I've used Access and have forgotten quite
a
lot.
I tried your suggestion, but now I get the following error:
Control can't be edited; it's bound to the expression
'DateSerial(Year([Package Mail Date]),Month([Package Mail
Date])+3,Day([Package Mail Date]+90))'.
Does this make any sense to you?
Allen Browne said:When you set the After Update property to:
[Event Procedure]
and then click the Build button (...) beside the property, Access opens
the
code window.
In that context, you can use Me. to refer to the form that this module
belongs to. For example, if the form was named Form1, then Me is
equivalent
to:
Forms![Form1]
jdasnoit said:Allen,
Thanks for your reply...what is the Me.?
:
If you need to allow users to change the value in a field, you need to
store
it.
Use the AfterUpdate event of the control(s) its value is based on to
assign
the inital value. The users can then change it as needed.
For example, if your invoice is normally due 14 days from the
InvoiceDate,
but a user can change to to 30 days or something else, you would use
this
in
the AfterUpdate event procedure of InvoiceDate:
Private Sub InvoiceDate_AfterUpdate()
Me.DueDate = DateAdd("d", 14, Me.InvoiceDate)
End Sub
More info in article:
Calculated Fields
at:
http://allenbrowne.com/casu-14.html
How do I allow users to change a calculated date in a form field?
Allen Browne said:Change the Control Source property of the text box to the name of the field
where you want the value to be stored.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
jdasnoit said:Thanks Allen...that was very helpful! I really appreciate your assistance
on
this, as it's been a while since I've used Access and have forgotten quite
a
lot.
I tried your suggestion, but now I get the following error:
Control can't be edited; it's bound to the expression
'DateSerial(Year([Package Mail Date]),Month([Package Mail
Date])+3,Day([Package Mail Date]+90))'.
Does this make any sense to you?
Allen Browne said:When you set the After Update property to:
[Event Procedure]
and then click the Build button (...) beside the property, Access opens
the
code window.
In that context, you can use Me. to refer to the form that this module
belongs to. For example, if the form was named Form1, then Me is
equivalent
to:
Forms![Form1]
Allen,
Thanks for your reply...what is the Me.?
:
If you need to allow users to change the value in a field, you need to
store
it.
Use the AfterUpdate event of the control(s) its value is based on to
assign
the inital value. The users can then change it as needed.
For example, if your invoice is normally due 14 days from the
InvoiceDate,
but a user can change to to 30 days or something else, you would use
this
in
the AfterUpdate event procedure of InvoiceDate:
Private Sub InvoiceDate_AfterUpdate()
Me.DueDate = DateAdd("d", 14, Me.InvoiceDate)
End Sub
More info in article:
Calculated Fields
at:
http://allenbrowne.com/casu-14.html
How do I allow users to change a calculated date in a form field?
jdasnoit said:Hi Allen,
I'm still trying to get this to work. Here is more detail...
Subject: Allowing users to change data in bound fields on form 1/4/2006
11:35 AM PST