DateAdd Feature

AMC31

Registered User.
Local time
Today, 21:17
Joined
May 20, 2003
Messages
17
I have a field [VerbalDue]. I have used the DateAdd function to caluculate the date; however I also want the user to be able to manually change the date.

Control Source for Verbal Due.....
=DateAdd("y",+7,[FileStart_D])

Is this possible? Thanks!!!!
 
You'll need to create a macro or write VBA code for this.

If you use VBA Code, add it to the FileStart_D_AfterUpdate Event

If not IsNull([FileStart_D]) Then
[VerbalDue] = DateAdd("y",+7,[FileStart_D])
End IF

That should do it for you. If [VerbalDue] is a field in the table, make VerbalDue the Control Source for the [VerbalDue] control, If not you can leave it blank. If it is not bound to a field, you'll also need to add the above code to the Form_Current Event.

Good Luck
 
Thanks. But I still can not make changes.

Let me explain in a little more detail...When a new project is started, the File Started check box is checked and the Date field is automatically entered with todays date. That date can be manully changed if necessary.

After the date is automatically completed...the Verbal Due field used the DateAdd feature to add 7 days to the date the project was started.

Sometimes, it will be necessary to manually change the verbal due date.

Can I have the DateAdd function and manually change the date?

Thanks for your help...I greatly appreciate it!!!!
 
YES YOU CAN! Just remove your formula as the controlsource of the VerbalDue field. If VerbalDue is a field in the form's table, enter VerbalDUe as the ControlSource else leave it blank.

If that doesn't work, you have another problem.
 
I love the way you are so sure of yourself...:p

I must be a dummy...I have attached the database

Open frmBroker

When you check File Started three things will happen

1. File started date will complete todays date.
2. Verbal due will complete 7 days from file started
3. Narrative due will complete 14 days from file started

I need the ability to manually change that.

I am sending my original...not the one with your suggestions.
Thanks for your help...I GREATLY appreciate it.
 

Attachments

WORKS FOR ME.

1) Delete the formulas from the [VerbalDue] and [NarraDue] Controls

1) Place the field [FileStart_D] on your form. Suggest somewhere at top of form. You can set its visible property to no to hide it if you like.

2) Add the following Code on the Form_Current Event.

Private Sub Form_Current()

[FileStart_D] = Date
[VerbalDue] = DateAdd("y", 7, [FileStart_D])
[NarraDue] = DateAdd("y", 14, [FileStart_D])

End Sub

If you are not familiar with writing VBA Code, suggest you get a book on MS Access Programming.
 
OK...your code words if FileStart_D is always the current date. But it is NOT. I don't think you understand the question.

A box is checked...todays date goes into the FileStart_D field.
VerbalDue and NarraDue are 7 & 14 days following. I use the DateAdd function, but I need to have the ability to manually change it also.

Is there anyone that can help me with this? Please!!!!
 
Setthe Default value for Verbal Due.....
=DateAdd("y",+7,[FileStart_D])
 
Put the code on the after update event of your check box.

Private Sub Cbo_AfterUdpate()

If Me![Cbo] = true then
[FileStart_D] = Date
[VerbalDue] = DateAdd("y", 7, [FileStart_D])
[NarraDue] = DateAdd("y", 14, [FileStart_D])
Else
[FileStart_D] = null
[VerbalDue] = null
[NarraDue] = null
End IF

End Sub
 
It still does not let me change the VerbalDue & Narrative Due manually. There may be some instances when they have 10 days to return the VerbalDue.

HELP!!!
 
Take your formulas off the controlsoure properties of the date fields and replace them with the FieldNames.

[FileStart_D].controlsource = FileStart_D
[VerbalDue].controlsource = VerbalDue
[NarraDue].controlsource = NarraDue

Have you compacted and repaired the database recently? Like in the last few minutes. If not give it a shot.
 

Users who are viewing this thread

Back
Top Bottom