Display hidden field in a continuous form after update of a null m

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a continuous form, I have fields memAction and dtmComplete. I do not want
users to enter a completion date if the memAction field is null. So I want
the date field initially hidden for each record, then displayed permanently
by record when the memo field is not null. I have tried the following with
no luck:
Form On Load
Private Sub Form_Load()
Me.dtmComplete.Visible = False
End Sub

Memo field after update
Private Sub memAction_AfterUpdate()
If Me.memAction Is Null Then
Me.dtmComplete.Visible = False
Else
Me.dtmComplete.Visible = True
End If
End Sub

Help
 
If I'm following the logic of what your code is doing, the dtmComplete
control is set invisible when the form loads. Then, after the memo control
is updated (and ONLY after an update), if the memo field is null (are you
also testing for a zero-length string somewhere else?), set the dtmComplete
invisible, otherwise, set it visible.

To me this means the form will always start out with an invisible
dtmComplete, even if the record that is loaded has something in the memo
control.

If you want these things to change whenever the record changes, try the
OnCurrent event to re-evaluate the condition of the memo control.

By the way, having controls blink in and out of existence (i.e., visible)
can be disconcerting to users. Consider setting the enabled property
instead, so the control is grayed out or not.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
Back
Top