[AccessD] Error 3314 (required field) - trap in form_error

Dan Waters dwaters at usinternet.com
Sun May 27 09:39:24 CDT 2007


Hi Steve,

The ZLS in memo fields occurs when a user has initially entered some data,
and then erases that data.  After that, the code doesn't see a null value,
but does see a ZLS - odd but consistent.  That's just normal user activity.

I don't use the Validation rule because I want to give users a message box
that is formatted with Bold text, rather than standard text.  I've gotten
quite a bit of feedback that this is preferred.


This is what I use for a MsgBox (This was described on someone's site -
don't remember who):

Public Function FormattedMsgBox(stgSound As String, stgPrompt As String,
Optional Buttons As VbMsgBoxStyle = vbOKOnly, Optional Title As String =
vbNullString, Optional HelpFile As Variant, Optional Context As Variant) As
VbMsgBoxResult

    Call PlaySoundFile(stgSound)

    If IsMissing(HelpFile) Or IsMissing(Context) Then
        FormattedMsgBox = Eval("MsgBox(""" & stgPrompt & """, " & Buttons &
", """ & Title & """)")
    Else
        FormattedMsgBox = Eval("MsgBox(""" & stgPrompt & """, " & Buttons &
", """ & Title & """, """ & HelpFile & """, " & Context & ")")
    End If

End Function

Also, I want to provide a specific sound with each type of message
(Question, Information, Critical, etc.), so I added that capability too. 


Thanks,
Dan



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel
Sent: Saturday, May 26, 2007 4:55 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Error 3314 (required field) - trap in form_error

Thanks, Dan.

Well, I realise there would be a difference of style or preference here, 
as against a question of right and wrong.  For myself, if I was ending 
up with a ZLS in a memo field, my approach and advice would be to 
address the problem that is causing this, rather than trying to cover 
off the possibility in my validation code.

Similarly, in the scenario originally described by Gale (Required field 
being trapped on a form event), my preference would still be the 
code-free solution of using Validation Rule property.

In fact, I would also normally use Validation Rule rather than code in 
the case of situations such as your:
Not IsNull(A) And IsNull(B)

Regards
Steve


Dan Waters wrote:
> Steve,
> 
> I agree that while the Screen.ActiveControl may be causing the wrong
control
> to be checked, the value of the control for memo fields could indeed be a
> zero length string and must be checked for.  In this example all controls
> are being checked (I assumed all the controls on the form could contain
> text), so checking for a ZLS on other controls won't hurt.
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
















































































































































































More information about the AccessD mailing list