Solved Enter a date, check box is true, click checkbox to false, clear date. (1 Viewer)

Chief

Registered User.
Local time
Today, 06:57
Joined
Feb 22, 2012
Messages
156
Hello,
I originally had some code that on click put in today's date. Have some issues with that, and probably not the best use in this instance.
So, what I want to achieve is;
1 - Enter a date, the checkbox is then enabled and true. The Date field becomes enabled = false.
2 - Uncheck the checkbox (False) then (with a msgbox) clear the date, checkbox is then disabled. The date field enabled = true.
This is the code I have been working on: (Enter Date)

Code:
Private Sub TxtIFA_Sent_Change()
    If IsNull([TxtIFA_Sent]) Then
        Me.ChkIFA_Sent = False
        Me.ChkIFA_Sent.Enabled = False
        Me.TxtIFA_Sent.Enabled = True
    Else
        Me.ChkIFA_Sent = True
        Me.ChkIFA_Sent.Enabled = True
        Me.TxtIFA_Sent.Enabled = False
    End If
End Sub

and: (Uncheck Checkbox)

Code:
Private Sub ChkIFA_Sent_Click()
    If Me.ChkIFA_Sent = True Then
        Dim iResponse As String
            iResponse = MsgBox("Are you sure you want to remove the IFA sent date?", vbYesNo)
        Select Case iResponse
        Case vbYes:
            Me.ChkIFA_Sent = False
            Me.ChkIFA_Sent.Enabled = False
            Me.TxtIFA_Sent.Enabled = True
            Me.TxtIFA_Sent = ""
        Case vbNo: ' Do Nothing
            Me.ChkIFA_Sent = True
        End Select
    End If
End Sub


I have lots of these to do. (My Form)
1635910604398.png


Do I also need to call these anywhere else??

thanks

**EDIT** I changed the entering date function to after update. I think this is working.
The on click for check box, does nothing when unchecked, but does what it should when click again.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:57
Joined
Jul 9, 2003
Messages
13,795
Wakey-wakey Chief! You've already asked this question and it has received numerous answers! See Here:-

Surely there is an easier way, Lots of Check Boxes and with same code​

 

Chief

Registered User.
Local time
Today, 06:57
Joined
Feb 22, 2012
Messages
156
Wakey-wakey Chief! You've already asked this question and it has received numerous answers! See Here:-

Surely there is an easier way, Lots of Check Boxes and with same code​

Lol 😂
Sort of different.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:57
Joined
Jul 9, 2003
Messages
13,795
Sort of different.

I just thought I'd bring you up-to-date on my thoughts about your posting here. The previous thread where I provided an answer, I never received any comment from you on whether what I had done was correct, useful or whatever. Indeed, I don't think you commented on anyone's help. However looking at your other posts you do seem to play ball, so I think it might have just been a an oversight.

Anyway, I can't be bothered to put any more time & effort into it. I suspect there's enough information in my responses, in the previous, very similar post for you to be able to work out what to do yourself. Uncle Gizmo Flounces off the edge of the Screen....
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:57
Joined
Feb 19, 2002
Messages
34,436
It is wrong to have two data fields linked together like this. Just keep the date. I you want an easy way for the user to enter a date, use a button to put a date in the date field if it is null and remove it if there is a value. Once you normalize your table as was suggested in your other thread, this will be simple.
 

Chief

Registered User.
Local time
Today, 06:57
Joined
Feb 22, 2012
Messages
156
I just thought I'd bring you up-to-date on my thoughts about your posting here. The previous thread where I provided an answer, I never received any comment from you on whether what I had done was correct, useful or whatever. Indeed, I don't think you commented on anyone's help. However looking at your other posts you do seem to play ball, so I think it might have just been a an oversight.

Anyway, I can't be bothered to put any more time & effort into it. I suspect there's enough information in my responses, in the previous, very similar post for you to be able to work out what to do yourself. Uncle Gizmo Flounces off the edge of the Screen....
G'Day mate,
I appreciate everyone and all input to my issues.
I am a novice with access and coding.
I didn't comment much on the previous thread as I was still getting my head around the responses and solutions.
I always try and come back to comment and mark as solved and thank everyone.
I have that particular thread in mind today and will be bending my brain around it.
Thank you again.
 

Users who are viewing this thread

Top Bottom