Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

dbf2mysql parameter, WWWXXXAPC, wwwxxxAPC, How to unsubscrube from dategen spam, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text



#1: Evaluate UNBOUND textbox using custom function.

Posted on 2006-05-09 22:55:06 by ApexData


I have an UNBOUND textbox Text1 that I want to validate in code.
I want to lock the user into the field until Valid Data is entered.
I created the following Function:

Private Function Validate(MyControl As Control) As Boolean
If Len([Text1]) < 6 Then
MsgBox "Password too small"
' Etc..Etc.......
Validate = True
End If
End Function

I tried each of the following INDIVIDUALLY and ran into problems:

Validation Rule =Validate([Text1])
'Keeps evaluating as True, despite the function running properly.

On Change =Validate([Text1])
'Evaluates character by character. Not good here.

Before Update =Validate([Text1])
'Evaluates fine, but allows the user to leave the field in error

AfterUpdate =Validate([Text1])
'Evaluates fine, but allows the user to leave the field in error

I want to validate at the control not the form level, and I want
to evaluate in a custom coded function as shown.

Any Advice ???

Report this message

#2: Re: Evaluate UNBOUND textbox using custom function.

Posted on 2006-05-10 00:52:38 by Rich P

Use a dialog form to open it modally. You can trap for incorrect input
in the Close event of the form. If the input is incorrect - don't close
the form or close the app. The only way to close it would be to kill
the app.

DoCmd.OpenForm "passwordForm", , , , , acDialog

If passwordForm.IsOK() = False Then
DoCmd.Close acForm, Me.Name
GoTo Exit_Form_Open
End If

You can also create custom properties (Get, Set, Let) within the dialog
form to return the input. If the input is invalid, the shut things

set this property in the passwordForm. When you close the passwordForm
you can now trap the input.

Public Property Get IsOk() As Boolean
IsOk = m_IsOk
End Property


*** Sent via Developersdex ***

Report this message