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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why?

Status
Not open for further replies.

kruxty

Programmer
Jul 17, 2001
197
0
0
PT
I've a memo field in a database access.
I've been trying to change the value of the var with this code:
Code:
If Resumo = "" or isNull(Resumo) then
Resumo = "Resumo não disponível"
end if

The problem is if the resume isn't blank it is affected anyway!
What's wrong? Does a memo field (beeing so big) can't be affected?
Tkx to all help ;)
 
what i've used in the past is a temp variable to check the data, memo fields are a form of blob type, they contain no data just a pointer to the location of the content, so there's nothing to check against just stuff to output :

Resumo = RS("Resumo")
If Resumo = "" or isNull(Resumo) then
Resumo = "Resumo não disponível"
end if


[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
But, i put call a Sub so the value passes!
I made a response.write and write it all the memo.
 
memo fields will output but are difficult to use in a comparison, hence why you can response.write it, but cant if rs(memofield) = "" then blah

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Why not just assign a variable to it's value and do alength check on the variable?

Also, saw an isEmpty coment above. Empty in vb is defined as "never assigned a value". When the recordset is built it i built as a set of nested collecitons. The Recordset has a collection of Records, each record has a collection of fields,each field has a value (of course) as well as multiple other properties (such as size). You can't treat a fieldobject as a standard variable that hasn't been initialized simply because it's value property hasn't been used. Whether or not the database had a value for the field it will still be an instantiation of field object (Not Empty) which is then assign numerous values for it's properties. If it was made Empty somehow then you wouldn't be able to access it's value because it wouldn't have a value property to access.

In any event, just thought I would clarify (or further muddy :p ) that.

I just threw together a quick test and isNull appears to work fine for me. I guess since the value has been assigned a null pointer it qualifies as null. I don't understand why itis working for me and not you though :p

-T

barcode_1.gif
 
also when you pass the value via sub or function it is being assigned to another variable, the variable assignment in the argument, you then use the variable in the sub/function. hopefully that will explain why you ocould do that without trouble.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top