jpr wrote:
Hello,
I have a form with two controls: txt1 and txt2.
I need to add a code to the afterupdate event that adds a text in txt2
according to the data in txt1.
This is what I need:
If me.txt1 = "ok" then (txt 1 can contain any data)
Me txt2 = "Hello"
Else
If Isnull me.txt1 then
Me.txt = "" (it should not contain any record)
end if
Any idea why this is not working?
Thanks.
HI jpr,
I have no idea what your subject title means but looking at your code,
you are not using the isnull() function properly. Your if statement
doesn't look correct either and it will help you see what your code is
doing if you use the tab key to indent things.
Here's how I would rewrite what you have. I assumed your txt2 is bound
to a field from a table or query and that the value of what is written
by the user in txt1 will change the value of that field for the current
record.
If me.txt1 = "ok" then '(txt 1 can contain any data)
Me txt2 = "Hello"
ElseIf Isnull (me.txt1) then
Me.txt2 = null '(it should not contain any record)
end if
--
Tim
http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto