IsNull problem runtime 2447

  • Thread starter Thread starter mark r
  • Start date Start date
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
 
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
 
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
 
Back
Top