IsNull problem runtime 2447

M

mark r

on the ---> line I get error message:
run time 2447
there is an invalid use of .(dot) or ! operator or
invalid parenthesis

Private sub form_timer()
for each ctl in me.controls
if me.newrecord = true then
if ctl.tag = "checkred" then
--> if isnull(ctl.value) then
if ctl.backcolor = vbyellow then
ctl.backcolor=vbred
else if ctl.backcolor=vbred then
ctl.backcolor=vbyellow
else ctl.backcolor=vbwhite
end if
end if
end if
end if
end if
 
M

M.L. Sco Scofield

What is ctl.Name when you get this error?

My guess is that it's a control that doesn't have a value. IE, a command
button.

You need to put in another If-Then or a Select Case to check the control
type.

Look up TypeOf in Help. (In the Immediate window type TypeOf, hit <F1>,
click the samples link.

If you can't find the help example, take a look at
http://support.microsoft.com/default.aspx?scid=kb;en-us;132071.

Good luck.

Sco
 
M

M.L. Sco Scofield

Mark,

You need to go back to ground zero and think through your logic from the
beginning.

If your box is empty, the color is set to white.

If it's not, *none* of your color changing logic is ever run.

All in all, you've written a lot of code to do-nothing no matter what.

Set a break point and single step your code to see what's happening.

Sidebar: Using the timer like this is kind of crude. If you want the color
to change when something happens in a text box, the preferred method would
probably be to use each text box's change or after update event. Hard to say
which not knowing what you're trying to do.

Good luck.

Sco
 

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