Checkbox VB code after update

  • Thread starter newkid via AccessMonster.com
  • Start date
N

newkid via AccessMonster.com

Hi All,

Could you please find the time to help me out.

I have a checkbox that the user will update once a job is completed, called
Resolved. The checkbox should automatically update the Resolution_Date text
box with the current date. The Resoultion_Date feild is locked. I also have
a different type of user who can uncheck Resolved putting it back in the que.
I need help with the code so that if the Resolution_Date feild is already
populated and the check box is checked then the textbox Follup_Res_Date be
auto populated with the current date, leaving the Resolution_Date at the
original date when it was first thought to be completed.

Here is my current code which runs without any errors however, it actually
doesnt do anything when I check or uncheck the boxes:

Private Sub Resolved_AfterUpdate()

If Me.Resolved = True And Me.Resolution_Date = Null Then
Me.Resolution_Date = Date
ElseIf Me.Resolved = True And Me.Resolution_Date = Not Null Then
Me.Followup_Res_Date = Date


End If

End Sub

Please Help,

Thanks,
NewKid
 
A

Arvin Meyer MVP

Try this:

Private Sub Resolved_AfterUpdate()

If Me.Resolved = True And Not IsNull(Me.Resolution_Date) Then
Me.Resolution_Date = Date
ElseIf Me.Resolved = True And Not IsNull(Me.Resolution_Date) Then
Me.Followup_Res_Date = Date

End If

End Sub
 
N

newkid via AccessMonster.com

OK so this code works for the follow up part but for some reason its not
working for the initial resolution. And its only updating the table but does
not show up in the form when the checkbox is clicked :S

Private Sub Resolved_AfterUpdate()

If Me.Resolution_Date = Null Then
If Me.Resolved = True Then
Me.Resolution_Date = Date
End If
ElseIf Me.Resolution_Date = Not Null Then
If Me.Resolved = True Then
Me.Followup_Res_Date = Date
End If

End If

End Sub
 
N

newkid via AccessMonster.com

Hi Arvin,

Thanks for replying. Your code worked the same as my revised code did.
Here are the outstanding issues:

1. For some reason on the form itself when you hit the check box it doesnt
update the dates. However, when I open the table the Followup_Res_Date is
updated.

2. The initial Resolution_Date is not populating at all.
Try this:

Private Sub Resolved_AfterUpdate()

If Me.Resolved = True And Not IsNull(Me.Resolution_Date) Then
Me.Resolution_Date = Date
ElseIf Me.Resolved = True And Not IsNull(Me.Resolution_Date) Then
Me.Followup_Res_Date = Date

End If

End Sub
[quoted text clipped - 31 lines]
Thanks,
NewKid
 
N

newkid via AccessMonster.com

I made an adjustment to your code and it looks like its working beautifully.
The two lines you sent me were identical one should not have the NOT in it.

Thanks for your help!!!

Hi Arvin,

Thanks for replying. Your code worked the same as my revised code did.
Here are the outstanding issues:

1. For some reason on the form itself when you hit the check box it doesnt
update the dates. However, when I open the table the Followup_Res_Date is
updated.

2. The initial Resolution_Date is not populating at all.
Try this:
[quoted text clipped - 13 lines]
 

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