text box length

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wanted to verify the length of text box.
If the text box is empty do something

I use following VBA code.

If Len(txtMyText) = null then
MyFunction
else
MyFunction1
end if


The problem is when the ttext box is empty then the len function return null.
I got Null = Null, but VBA execute Myfunction1 not MyFunction.

Any suggestion?
Any informaiton is great apprecitaed,
 
Len(Me.TextBoxName.Value & "") = 0

Above will tell you if the textbox is empty, regardless of whether it's a
null value or an empty string.
 
Souris said:
I wanted to verify the length of text box.
If the text box is empty do something

I use following VBA code.

If Len(txtMyText) = null then
MyFunction
else
MyFunction1
end if


The problem is when the ttext box is empty then the len function
return null. I got Null = Null, but VBA execute Myfunction1 not
MyFunction.

If IsNull(txtMyText) then
....


Acki
 
Instead of testing the length why not check to see if the value is Null?

If IsNull(txtMyText.Value) then
 

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

Back
Top