Need to validate textboxes and enable others if info has been entered correctly

Elyso

New member
Local time
Today, 03:02
Joined
Aug 31, 2009
Messages
8
I have a form with a couple of text boxes and and some check boxes. The data that is entered in some of these textboxes should be validated with some preset rules and if the criteria are met other text boxes should be enabled. I was hoping that someone can help me in the right direction here.


1.
I have 4 text boxes which are called ...

Verification_name-1
Verification_name-2
Verification_name-3
Verification_name-4

In addition there are another 4 textboxes called (each name and date goes together even though the text boxes are separate)

Verification_Date-1
Verification_Date-2
Verification_Date-3
Verification_Date-4

The validation I need to be performed is when a string with a length equal to 4 is entered into any of the "Verification_name" text boxes the corresponding "Verification_Date" text box should be enabled. If no info is entered or if the string is longer than 4 then the "Verification_Date" text box should be disabled.


2.
Then I also need help with another validation. When there are dates entered into all 4 textboxes two more textboxes should be enabled. These are called…. They should be disabled by default.

Approval-By
Approval-Date


3.
An at last, when these two textboxes are not equal to null, then a checkbox should be enabled. The checkbox is disabled by default and is called.

All_info_approved

Any help here would be greatly appreciated.... Thank you in advance.
 
Verification_name-1
Verification_name-2
Verification_name-3
Verification_name-4

In addition there are another 4 textboxes called (each name and date goes together even though the text boxes are separate)

Verification_Date-1
Verification_Date-2
Verification_Date-3
Verification_Date-4

The validation I need to be performed is when a string with a length equal to 4 is entered into any of the "Verification_name" text boxes the corresponding "Verification_Date" text box should be enabled. If no info is entered or if the string is longer than 4 then the "Verification_Date" text box should be disabled.
just curious here...but i bet my last nickle you pasted this question from somewhere else. but at any rate, to get the validation, try this:
Code:
private sub Ver_Name-1_lostFocus()

   if len(me.Ver_name-1) = 4 then
      me.Ver_Date-1.enabled=true
   else
      me.Ver_Date-1.enabled=false
   end if

end sub
you can also use the activeform.activecontrol or me.activecontrol to get the name of the user's current position as sort of a "uniform" way of writing the code. but, the extraction functions you would need to use would be just as time consuming as writing what i did above for everyone of your 4 controls manually. so you might as well just do it that way...it'll be easier to modify in the future too.

and BTW, i would generally consider it bad practice to put -1 in a control name. For a program to see that, it would read it as subtract 1. it's a risk, so you may want to consider changing it
 
I have attached a sample file that will show you how I would handle the verifications you described.
 
Last edited:
Sorry to say Ajetrumpet but you just lost your last nickle... I composed this question yesterday and posted it on this and only this forum, nowhere else. It wouldn't make sense to post a question from somewhere else (at least not if the answers were to be found in the other place too).... but feel free to let me know where this post is to be found otherwise....

Thank you for your help both of you and Mr. B, the file you shared was awesome. It helped me out to 99%, I just had to do a few adaptations to get it working with the rest of my forms and macros. Thx a million :D
 

Users who are viewing this thread

Back
Top Bottom