Len(Me.Lot_no)

S

shiro

I put below code in my project :
Debug.print Len(Me.Lot_no)
In immediate window,I found that
there are spaces on the front and
behind of the len.
like: space5space
..I think,this condition cause the fail
of my code execution.

I have below code in Form's before update
If Len(Me.Lot_no) <> Me.cbo_Product.Column(1) then
Cancel = True
MsgBox "Invalid lot no"

I try put :
Debug.Print Me.cbo_Product.Column(1)
and it return 5 without space anywhere.

So the form updating keep fail anytime.How
to solve this problem.?Thank's for help.
Rgds,

Shiro
 
S

shiro

Beetle,
it seems doesn't work.The space still remain on the front and behind.
Rgds,

Shiro
 
A

AccessVandal via AccessMonster.com

But you're not evaluating the length between the two controls values.
Use the Trim function given by Beetle.

If Len(Trim(Me.Lot_no)) <> Len(Me.cbo_Product.Column(1)) Then

Remember to include error trapping if there are nulls for the Len function
else..

Len(ControlName & " " ) to prevent nulls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top