Checkbox Help

Vergy39

Registered User.
Local time
Today, 06:20
Joined
Nov 6, 2009
Messages
109
I need to add a check box to a form that when checked will auto fill a date into a "Date Due" field. For example, I assign an item on 12/3/09. If I check the box, I want the "Date Due" Field to auto fill with a date that is 10 days beyond the Date assigned, or 12/17/09. Not counting weekends. Can someone assist please. Any assistance is greatly appreciated.

David V
 
In your Check box's After put the following code;
Code:
If Me.Check3.Value = True Then
        If Weekday(Date + 10) = 1 Then
            Me.Text5.Value = Date + 11
                If Weekday(Date + 10) = 7 Then
                    Me.Text5.Value = Date + 12
                Else
                    Me.Text5.Value = Date + 10
                End If
        End If
    End If
 
Thanks John for the assistance. I pasted this into the "After Update" as you said. I changed the Me.Check3 to Me.Check27 which is the name of the check box on my form. I changed the Me.Text5.Value to Me.SLADate.Value as that is the field that I want to input the date. I now get a "compile error" stating "Expected End Sub".

Also, I after update, I need to have a yes/no box checked on another table entitled "Cases". The field thta the yes/no box is in is called BBB. Can you also help me with that?

Thanks
David V.
 
Thanks John for the assistance. I pasted this into the "After Update" as you said. I changed the Me.Check3 to Me.Check27 which is the name of the check box on my form. I changed the Me.Text5.Value to Me.SLADate.Value as that is the field that I want to input the date. I now get a "compile error" stating "Expected End Sub".

........

Your going to need to post the full code you are using.

........

Also, I after update, I need to have a yes/no box checked on another table entitled "Cases". The field thta the yes/no box is in is called BBB. Can you also help me with that?

Thanks
David V.

I'm presuming that there is some link that you can use to identify the record in your table that needs to be updated. In which case you could simply run an update query to update the check box in that particular record, or simply run the raw SQL to do the same job.
 
Your going to need to post the full code you are using.

Here is what I was using:

Private Sub Check27_AfterUpdate()
If Me.Check27.Value = True Then
If Weekday(Date + 10) = 1 Then
Me.SLADate.Value = Date + 11
If Weekday(Date + 10) = 7 Then
Me.SLADate.Value = Date + 12
Else
Me.SLADate.Value = Date + 10
End If
End If
End If
 
Sorry my bad try the following;
Code:
If Me.Check27.Value = True Then
     If Weekday(Date + 10) = 1 Then
          Me.SLADate.Value = Date + 11
               ElseIf Weekday(Date + 10) = 7 Then
                    Me.SLADate.Value = Date + 12
               Else
                    Me.SLADate.Value = Date + 10
       End If
End If
My logic wasn't quite with it yesterday, the attached uses the above code.
 

Attachments

Sorry my bad try the following;
Code:
If Me.Check27.Value = True Then
     If Weekday(Date + 10) = 1 Then
          Me.SLADate.Value = Date + 11
               ElseIf Weekday(Date + 10) = 7 Then
                    Me.SLADate.Value = Date + 12
               Else
                    Me.SLADate.Value = Date + 10
       End If
End If

Thanks, Got it to work, but changed a few things. I made a new field for the BBBDueDate instead of using the SLADate. It works, but not calculating correctly. If I used 12/4/09, it returned 12/14 which is 10 days, but I need workdays. I need to subtract the weekends. I will mess around with it on Monday, but have to go now. Thank God its Friday.

Again, thanks for your help. Your terrific.
David V.
 
OK I think we may have been working at cross purposes, I thought you just didn't want to end on a weekend, but what you meant was you didn't want weekends counted as part of your ten days, I've not tested this but I think it should give you the result you want;

Code:
If Me.Check27.Value = True Then
     If Weekday(Date + 10) = 1 Then
          Me.SLADate.Value = Date + 13
               ElseIf Weekday(Date + 10) = 7 Then
                    Me.SLADate.Value = Date + 14
               Else
                    Me.SLADate.Value = Date + 12
       End If
End If
 
OK I think we may have been working at cross purposes, I thought you just didn't want to end on a weekend, but what you meant was you didn't want weekends counted as part of your ten days, I've not tested this but I think it should give you the result you want;

Code:
If Me.Check27.Value = True Then
     If Weekday(Date + 10) = 1 Then
          Me.SLADate.Value = Date + 13
               ElseIf Weekday(Date + 10) = 7 Then
                    Me.SLADate.Value = Date + 14
               Else
                    Me.SLADate.Value = Date + 12
       End If
End If

Thanks so much. This does the trick.

David V.
 

Users who are viewing this thread

Back
Top Bottom