View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default SetFocus Problems

Zane,

Following doenst work as you expect

If U1T1 = Empty Then
U1.Hide
MsgBox "Data must be entered in the First TextBox"


it tests the VARIANT U1T1, not the control it points to.
(you've set the VARIANT to an object, thus it's no longer empty)


try

if U1T1.Text="" then


TIP1:
in the VBE make sure the LOCALS window is visible.
Set a few breakpoints in your PROC (with F9)
and fire up your form.

It will stop in breakmode..
and now your LOCALS windows shows all your variables and objects and
their values and properties.



TIP2:
DECLARE your variables. and dont depend on implicit declarations.
You'll find that you make less typo's. and when declared as proper
datatypes, your coding will be easier cause the VBE's intellisense
will popup all appropriate properties for the variables you're working
with.

put OPTION EXPLICIT in the first lines of your code, and start of with
just DIM all your variables as variants. Then learn to declare them in
their proper data types.

suc6


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(Zane Greer) wrote: