UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Afterupdate Of Date Textbox Disables Checkbox, But Not In Oncurrent, Access 2013    
 
   
jmkeuning
post Jan 15 2020, 06:18 PM
Post#1



Posts: 186
Joined: 20-October 15



I have three "fields", and I only want a user to be able to put data in one. MediaArrived is a checkbox, ExpectedArrivalDate is a date textbox, and ExpectationRange is a textbox. The behavior of MediaArrived and ExpectationRange are behaving as expected, so I am not including the code for those here, but I can.

This is the AfterUpdate:

CODE
Private Sub ExpectedArrivalDate_AfterUpdate()

    If Len(ExpectedArrivalDate) > 0 Then
    
    Me.ExpectationRange.BackColor = Val("&H" & "E6E6E6")
    Me.ExpectationRange.Enabled = False
    Me.MediaArrivedBox.BackColor = Val("&H" & "E6E6E6")
    Me.MediaArrived.Enabled = False

    Else
    Me.ExpectationRange.BackColor = Val("&H" & "FFFFFF")
    Me.ExpectationRange.Enabled = True
    Me.MediaArrivedBox.BackColor = Val("&H" & "FFFFFF")
    Me.MediaArrived.Enabled = True
    
    End If
    
End Sub


This is the code in the OnCurrent:

CODE
If Len(ExpectedArrivalDate) > 0 Then

Me.ExpectationRange.BackColor = Val("&H" & "E6E6E6")
Me.ExpectationRange.Enabled = False
Me.MediaArrivedBox.BackColor = Val("&H" & "E6E6E6")
Me.MediaArrived.Enabled = False

Else
Me.ExpectationRange.BackColor = Val("&H" & "FFFFFF")
Me.ExpectationRange.Enabled = True
Me.MediaArrivedBox.BackColor = Val("&H" & "FFFFFF")
Me.MediaArrived.Enabled = True

End If


It's the same code.

And everything works except that MediaArrived is not disabled when Len(ExpectedArrivalDate) > 0 (I am testing this by taking the form in and out of design mode.) When I update ExpectedArrivalDate in the ordinary course, MediaArrived is disabled as expected.

Does the OnCurrent handle these things differently? I have the same code for the status of the ExpectationRange textbox and it properly disables the checkbox in both the AfterUpdate and the OnCurrent. (Incidentally, MediaArrivedBox is a shape behind the checkbox.)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th January 2020 - 09:55 PM