Error with validation...

Iceman Solope
10-18-2004, 01:55 PM
Hi

I have a little problem on Access 2002, I have a lot of textbox and I want to create some code in Access in order to validate him but when I create an expression like this:


If Me.txtActActuHTRBCDemRes.Value = "" Or _
Me.txtActActuHTRBCDemMed.Value = "" Or _
Me.txtActActuHTRBCPunta.Value = "" Or _
Me.txtActActuHTRBCInter.Value = "" Or _
Me.txtActActuHTRBCBase.Value = "" Or _
Me.txtActActuHTRBCSemPunt.Value = "" Or _
Me.txtActActuHTRBCSDemRes.Value = "" Or _
Me.txtActActuHTRBCSDemMed.Value = "" Or _
Me.txtActActuHTRBCSPunta.Value = "" Or _
....
.... Then
MSGBOX ("You need to put all statements")


The access send me an error "too much continuation of lines" :(

so the question is How can I do that? or exist an statement like this?:


set = strTEXTBOX as AllTextBoxOnForm
if strTEXTBOX = "" Then ...

Granty
10-18-2004, 02:14 PM
Dim ctl as Control

For each ctl in me.Controls

If TypeOf ctl is Textbox Then

If "" & ctl.Value = "" Then

Msgbox "You must enter blah blah"
ctl.setfocus

End If

End If

Next ctl

NEOLLE
10-19-2004, 06:38 AM
Hi, Im not sure if Len Function Exists in Access, but if it does.

You can replace your


If ctl.Value = "" Then
'to
If Len(ctl.Value) = 0 Then


Its must faster. :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum