S
Steve
I have Access97, 2000 and XP installed. I'm developing an Access97 project
for a client. I have the following code in the Open event of a form:
Dim Cbr As Object
Dim Ctl As Object
On Error GoTo ErrorHandler
Set Cbr = CommandBars("CourseCalendarMenu")
Set Ctl = Cbr.Controls("Facility")
Ctl.ListIndex = 1
Set Ctl = Cbr.Controls("Month")
Ctl.ListIndex = Month(Date)
Set Ctl = Cbr.Controls("Year")
Ctl.ListIndex = Year(Date) - 2000
I dim Cbr and Ctl as objects because the only reference I have is to the
Microsoft Office 10.0 Library; Microsoft Office 8.0 Library is not in my
list of references. The above code always runs without problem.
I have the following code in a public function in the same form:
Dim Cbr As Object
Dim Ctl As Object
Set Cbr = CommandBars("CourseCalendarMenu")
Set Ctl = Cbr.Controls("Month")
If Ctl.ListIndex > 1 Then
Ctl.ListIndex = Ctl.ListIndex - 1
Me!CalMonthNum = Ctl.ListIndex
Call SetDate("M", -1)
End If
There are five other similar public functions. The six public functions will
run for a while and then all of a sudden in all six functions I get a Error
#13 Type Mismatch. The error occurs in the same place in all six functions -
Set Ctl = Cbr.Controls("....."). Also if I do a compact, I immediately get
this error when I try to run any of the six functions although the code in
the Open event runs without a problem. What gets me is that the code line
Set Ctl = Cbr.Controls(".....") is in the Open event code and always runs
without a problem while the same code line in the six functions throws up
the error. Does anyone have any thoughts.
Thanks,
Steve
for a client. I have the following code in the Open event of a form:
Dim Cbr As Object
Dim Ctl As Object
On Error GoTo ErrorHandler
Set Cbr = CommandBars("CourseCalendarMenu")
Set Ctl = Cbr.Controls("Facility")
Ctl.ListIndex = 1
Set Ctl = Cbr.Controls("Month")
Ctl.ListIndex = Month(Date)
Set Ctl = Cbr.Controls("Year")
Ctl.ListIndex = Year(Date) - 2000
I dim Cbr and Ctl as objects because the only reference I have is to the
Microsoft Office 10.0 Library; Microsoft Office 8.0 Library is not in my
list of references. The above code always runs without problem.
I have the following code in a public function in the same form:
Dim Cbr As Object
Dim Ctl As Object
Set Cbr = CommandBars("CourseCalendarMenu")
Set Ctl = Cbr.Controls("Month")
If Ctl.ListIndex > 1 Then
Ctl.ListIndex = Ctl.ListIndex - 1
Me!CalMonthNum = Ctl.ListIndex
Call SetDate("M", -1)
End If
There are five other similar public functions. The six public functions will
run for a while and then all of a sudden in all six functions I get a Error
#13 Type Mismatch. The error occurs in the same place in all six functions -
Set Ctl = Cbr.Controls("....."). Also if I do a compact, I immediately get
this error when I try to run any of the six functions although the code in
the Open event runs without a problem. What gets me is that the code line
Set Ctl = Cbr.Controls(".....") is in the Open event code and always runs
without a problem while the same code line in the six functions throws up
the error. Does anyone have any thoughts.
Thanks,
Steve