Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count the value of a field

Status
Not open for further replies.

policechiefwiggum

Programmer
Mar 19, 2006
48
GB
Hi All,

I have a field, that i need to put some validation on, in order to pass the field value to another form, previously i've had a hidden caption with
Code:
Me.Change_Made.Caption = Me.Change_Made.Caption + 1
in the "onchange" setting, this works fine when text is typed in, however users have started to copy and paste enought charecters to meet the validation, but as they've copyed and pasted the value my currect code only sees this as 1 change. hence the validation failes.

if i could count the number of charecters in the field this would make the validation a bit more robust.
can anyone help?

Thanks in advance
 
Have a look at the Len function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Ok, so the Len function works perfectly. but now i'm getting an invalid use of null error.

a quick google has found the Nz function but i'm not sure how to use it correctly.

i've tried
Code:
If Me.new_update.Value = Null Then
TestNull = Nz(Me.new_update, 0)
End If
which isn't working either!
 
Why not simply this ?
TestNull = Nz(Me!new_update, 0)
If Len(TesNull) ....

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
i'm not sure if that would work.
my validation is basically
if the field is 1-9 charecters give message "enter more text"
if its 10 or higher write to database
if its 0 give message "no changes"

the code works fine except for the Null i keep getting
 
the code works fine except for the Null
Which code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top