Type Mismatch Error using Stephen Lebans' modCalendar Control

C

Chris O''''Neill

I've been using Stephen Lebans' modCalendar control without incident for
awhile (GREAT stuff, btw!), and then I changed a form to have it's source as
a table instead of a query. Now I'm getting a type mismatch error in the
basProximityFunctions module here:

Private Function xg_FindParentForm(ctl As Control) As Form
'* Returns the parent form of the passed control
Dim frm As Form
On Error Resume Next
Err.Clear
Set frm = ctl.Parent ' <------ this is where it stops!

I have alot of other forms that have tables as their control source and they
still work fine, so I'm not exactly sure what's going on here?

Anybody here have this problem before and know how I can fix it???? Thanks,
in advance, for any help and advice given!

Regards, Chris
 
C

Chris O''''Neill

Thanks, Alex, for the suggestion. While it didn't directly fix the problem,
it pointed me in the right direction so that I finally figured it out on my
own. I'll tell you what was wrong but first...

Your suggestion wouldn't have worked because the program was breaking before
that line was executing, so any code put after that line would not get run
before the program broke on the error. Besides, I didn't mention it in my
original post, but there already are nested "if err.number <> 0 then"
statements after that line that go all the way to "Set frm =
ctl.Parent.Parent.Parent.Parent.Parent.Parent" so that line would have been
redundant.

Anyway....

I got to thinking about what you said about it needing that line if the
control is on a tab page. That is indeed the case for my form. I wondered
why the code wouldn't work for that form, but was working with other forms.
I did some checking and, sure enough, that's the only form where the control
is on a tab page.

"So," I thought to myself, "Why is it breaking there when, if anything, it
should be breaking on the line that says 'Set frm = ctl.Parent.Parent'???"
And that's when my VERY dumb mistake hit me right between the eyes...

Several days ago, while working on another very tricky problem, I set the
debugger options to "break on all errors." So, of COURSE the code was
stopping on that line because I had SET THE DEBUGGER TO DO SO!!! (Duh!!!!)
And, of course the other forms weren't stopping on that line because they
weren't encountering the error!

So, I went in, set the debugger to "break on unhandled erorrs" and Voila!
Problem fixed!

Like I said... I'm SUCH a dummy! :D

Anyway, thanks for pointing me in the right direction, Alex. MUCH
appreciated!

Regards, Chris
 

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