on Load

MarMarMar

New member
Local time
Yesterday, 19:51
Joined
Sep 23, 2016
Messages
2
Hi,
After some hours of frustration :banghead: I have to ask you for help :)

I want to hide PICTURE1 if text1.value=<0

When I add this code to a button it works:

if text1.value=<0 then
picture1.visible=false
end if

When I add this code to the ON LOAD event it doesnt work. So i guess the value of text1 (value of a subform) is loaded after the ON LOAD event.

Can someone help me to solve this problem?
Thanks.
 
thanks for your replay. I had already tried that, but doesnt make a difference
 
The question in my mind is, What is the format of [Text1] ?

If Text1 is interpreted as text, then

Code:
if text1.value=<0 then

should actually be

Code:
if Len([text1])=<0 then

or possibly

Code:
if Val([text1])=<0 then

Every now and then VBA will do a "silent" type-conversion on you without claiming a "mixed type" in the process. IF statements are one case where this happens. If the types of the comparands are wrong, it won't matter WHERE you put that IF statement. It won't work correctly anyplace you put it.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom