validation multiple fields

eugz

Registered User.
Local time
Today, 11:17
Joined
Aug 31, 2004
Messages
128
Hi All.
In my detail form has field that I would like to validate during enter process. For 3 TextBox and 1 ComboBox I would like create validation if user forgot enter data and couple TextBox number of entering characters must =7. If is it possible how create those validation when user open form and start enter data or on save process? And if field(s) is validated so border to field(s) changed to red color.
Thanks.
 
Last edited:
I sometimes use Conditional Formatting to highlight fields that do not yet meet validation. This is not a substitution for the actual validation, but helpful to the users.
 
Hi All.
On Save_Click procedure I insert code:
Code:
    If IsNull(Me.txtLName) Then
        MsgBox "Please enter Last Name."
        Me.txtLName.BorderColor = 255
        Cancel = True
    Else
        Cancel = False
    End If

But after my error message I got system error message:
"Object doesn't support this property or method."
How to fix that problem? And how set focus on error TextBox with red border?

Thanks.
 
What line? The Cancel bit is probably not valid. The place to do validation is in the before update event, which can be cancelled:

http://www.baldyweb.com/BeforeUpdate.htm

Behind a button, you wouldn't cancel anything, just don't process the code that would do the saving.
 
Hi Paul. Thanks for replay.
Validation almost done. Only when field is validating I cannot get red border for according field(s).
And other problem. When everything is OK and Save event is executed new record come up on ListBox of MainForm. I would like at this moment highlight and point new record in ListBox. How to do it?

Thanks.
 
Make sure the border style isn't transparent.
 
My border style is solid and under validation condition code about border
Code:
Me.txtLName.BorderColor = RED
Thanks for help.
 
Like I said, I'd probably use Conditional Formatting, but I just tested this and it worked fine:

Me.Text4.BorderColor = vbRed
 
Thanks A lot.
Validation is done. Now all inporten fields are fill and Save event is executed new record come up on ListBox of MainForm. I would like at this moment highlight and point new record in ListBox. Or other words. New record will append at the bottom of LIstBox. How to hightlight new record or to hightlight last row of ListBox?. Right now after Save first row of ListBox is poited and hightlighted.

Thanks.
 
Last edited:
I'm not clear on what it is you're trying to accomplish.
 
In Detail form I create or edit record. That I validated to correct data. When if all data is correct record is saved and close Detail form that ListBox of Main form display it at the bottom of list. I would like at this moment highlight and point new record. Now when I return to Main form first record on ListBox Is highlighted and point.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom