Re: Auto Populate a Date

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

"Jeff L" wrote:

What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

"Jeff L" wrote:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?




.


Quantcast