Adding Values in Form Fields.

  • Thread starter cwAFcontractor via AccessMonster.com
  • Start date
C

cwAFcontractor via AccessMonster.com

Good Day, Here is a brief explantion of my Form "Preventive Maintenance". On
the form i have several Fields. Three of these fields i want to work together.

They are called Date Completed, PM Cycle, and Date Due. What I would like to
happen is when the Date Completed (date) field is changed i would like for it
to update the Date Due (Date) Field by adding the value in the PM cycle
(number of days) to the Date Completed. Is there a way to do this without
having to use a Query, SQL or VB code? Or do i have to use one of those and
if i do how would i make the wording to do this? Thanks for the help.
 
R

RonaldoOneNil

Just set the control source property of the Date Due field to

=DateAdd("d",[PM Cycle],[Date Completed])
 
C

cwAFcontractor via AccessMonster.com

Ok thanks, I did that and it works great...the only problem is now the
updated field no longer updates in the table in which the data is being
stored....i tried to create a hidden field that would be set to control
source of Date Due in the table and use an After Update code which is as
follows but i get a compile error. Do you know whats causing this..?

Private Sub Date_Completed_AfterUpdate()
On Error GoTo Err_Date_Completed_AfterUpdate

Dim NewDDue As Date

Set NewDDue = [Date Due].Value
Txtdatedue.Value = NewDDue


Exit_Date_Completed_AfterUpdate
Exit Sub

Err_Date_Completed_AfterUpdate:
MsgBox Err.DESCRIPTION
Resume Exit_Date_Completed_AfterUpdate
End Sub
Just set the control source property of the Date Due field to

=DateAdd("d",[PM Cycle],[Date Completed])
Good Day, Here is a brief explantion of my Form "Preventive Maintenance". On
the form i have several Fields. Three of these fields i want to work together.
[quoted text clipped - 5 lines]
having to use a Query, SQL or VB code? Or do i have to use one of those and
if i do how would i make the wording to do this? Thanks for the help.
 

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

Top