What is [Complaint Reason Codes]?
It seems to me like your controls in the code are not matching up. You
have 3 controls in the code, but in your original post you have a check
box for compliments and a drop down list for complaints.
Here is what your code should look like. I am calling the checkbox
Compliment. I am calling the dropdown Complaint. If you called them
different names then use those.
For the checkbox:
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.Complaint.Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
For the dropdown:
If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub
Me.[Complaint Reason Codes].Locked = True
:
Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.
If it stops again, post the line that it breaks on.
WMorsberger wrote:
i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.
:
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?
:
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?