Trapping errors from DLookup and SetFocus

I

Isis

Anyone give me some clues as to how to trap erros from these two ? If you
try and SetFocus to a non existent control what is returned.

Thanks
 
K

Klatuu

First, use an error handling routine. If you are not familiar with them, see
VBA help for On Error. There is a good example there. Now, as to specific
errors, a select case statement in the error handler routine is a good way to
trap for specific errors. As to the error you mentioned:
ield name in a DLookup can't be found (either the field to return or the
field to test) = 2001
Table Name in a DLooku[ can't be found = 3078
Control on a form can't be found = 2465
Form can't be found = 2450

Any time you want to know what error is returned for a situation, set it up
and make it happen. (That's how I got the numbers above)
 
I

Isis

First, use an error handling routine. If you are not familiar with
them, see VBA help for On Error. There is a good example there. Now,
as to specific errors, a select case statement in the error handler
routine is a good way to trap for specific errors. As to the error
you mentioned: ield name in a DLookup can't be found (either the field
to return or the field to test) = 2001
Table Name in a DLooku[ can't be found = 3078
Control on a form can't be found = 2465
Form can't be found = 2450

Any time you want to know what error is returned for a situation, set
it up and make it happen. (That's how I got the numbers above)

Isis said:
Anyone give me some clues as to how to trap erros from these two ? If
you try and SetFocus to a non existent control what is returned.

Thanks
Thanks Klatuu, that sounds great.

Regards
 
Top