Refer to a control

S

SHIPP

I have a form, a tab control, a sub form and a list box. I am trying to
requery the listbox by using the following:

Forms!frmCalendar.TabCtl0.Form!frmCalendarCreate.lsttmpCalendar.Requery

It keeps on coming up with an error that says it does not support this
property or method. I am using Access 2003. Can anyone tell me what I am
doing wrong?
 
D

Douglas J. Steele

From the name, I'm guessing that TabCtl0 is the Access Tab control. As such,
it doesn't have a Form property.

I'm guessing that you've put frmCalendarCreate as a subform on TabCtl0. If
that's the case, you don't need to refer to the Tab control. (The names of
all controls must still be unique, so there's no chance that you'll have,
say, Text1 on more than one Page of the Tab control)

Try:

Forms!frmCalendar!frmCalendarCreate.Form!lsttmpCalendar.Requery

Note that depending on how you add frmCalendarCreate as a subform on the tab
on frmCalendar, the name of the subform control may be something different
that frmCalendarCreate. It's the name of the subform control (on the tab
control) that you need to use if they're different.
 
S

Stefan Hoffmann

hi,
I have a form, a tab control, a sub form and a list box. I am trying to
requery the listbox by using the following:
Forms!frmCalendar.TabCtl0.Form!frmCalendarCreate.lsttmpCalendar.Requery
The pages on the TabControl are accessed via

TabControl.Pages.Item(Index)

where Index can be then name of a page in quotes or a integer, e.g.


TabControl.Pages.Item("PageName")

or

For i = 0 To TabControl.Pages.Count - 1
MsgBox TabControl.Pages.Item(i).Name
Next i
..

So you need to identify you page first and the control on it:

Forms!myForm.Form.myTabCtrl0.Pages.Item(0).Controls("myCtl").Caption


mfG
--> stefan <--
 
Top