PDA

View Full Version : textbox validation help please :-)



hypuk
10-14-2009, 11:09 AM
Hi there

I have two sets of nine text boxes, all with validation on them, basicaly a minimum and maximum character length, but I'm not going to have to fill all two sets of nine boxes in all of the time, how can I de activate the boxes that are not needed at the time? Could I use a tick box and tick the ones I want to activate?

Below is my code for the text boxes, any help would be much appreciated, I'm new to VBA too.

Thanks
Mark


Private Sub MultiPage1_Change()
If Len(cc1.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi1.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc2.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi2.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc3.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi3.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc4.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi4.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc5.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi5.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc6.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi6.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc7.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi7.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc8.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi8.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If
If Len(cc9.Text) < 6 Then
MsgBox "A minimum of 6 characters is needed for the Cost Centre" 'Your error raise code goes here
End If
If Len(pi9.Text) < 7 Then
MsgBox "A minimum of 7 numbers is needed for the PI Number" 'Your error raise code goes here
End If

End Sub

georgiboy
10-14-2009, 11:50 AM
Maybe something like this

Hope this helps

hypuk
10-14-2009, 12:08 PM
Hi georgiboy

That's fantastic!!!

Thanks for your help :yes:yes:yes:yes:yes

Mark

hypuk
10-15-2009, 04:04 AM
Any ideas on how I reverse this?

I.E I want the text boxes already populated and the checkboxes already ticked, and when I uncheck the checkboxes the text already populated in the textboxes dissapear?

Thanks
Mark

Bob Phillips
10-15-2009, 04:30 AM
You don't deserve to get people helping you. You waste our time by re-posting the same question, cross-posting without linking. We are not all just here for your free support!

hypuk
10-15-2009, 05:58 AM
I appreciate everyone's support, but as far as I'm aware these are 2 seperate forums, where probably not eveyone is a member of both forums

Bob Phillips
10-15-2009, 07:42 AM
It is irrelevant whether we are memberfs of both or not. You could have tow (or more) people working on the same problem at the same time, not knowing others are working on it. Worse, it might be solved elsewhere but another person may be unknowingly still working on it.

Personally, I will not waste my time helping cross-posters, whether they link or not, they are wasting my time, and I can help more deserving cases. When I see cross-posting, I will warn others so that they will know.