update a list box on a tab

G

Guest

Hello,

I have a form that has a Tab control. On the second tab i have a list box.
When the data on the main form is updated i need to update the Tab control's
list box. Any ideas??

JC
Vtek
 
D

Dorothy

Hello,

I have a form that has a Tab control. On the second tab i have a list box.
When the data on the main form is updated i need to update the Tab control's
list box. Any ideas??

JC
Vtek

Hello JC. You can go to the properties of a field that you update on
the main form and choose "After Update". Choose "Event Procedure"
from the pull down menu in there then write a code that says something
like

me.listbox = x

where x contains the updated values for the list box.

Good luck!

Dorothy
 
D

Dorothy

Thanks,

Would a list box on a tab control be some odd syntax/path name?

JC










- Show quoted text -

Sorry. I'm not sure I understand the question. A list box on a
control pulls data from a table or fields that you enter. You can
choose which values go into the list box by clicking on its
properties.

Does this help??

Dorothy
 
G

Guest

Dorothy,

I have a form with typical data. On that form I have a tab control with a
series of tabs. On one of the tabs I hava list box. When the data is changed
on the main form I need the data in the tab control's list box to change. In
the syntax, do i have to reference the mainform.tabcontrol.listbox or is it a
mainform.listbox reference?

JC
 
L

Linq Adams via AccessMonster.com

Actually,

Me.MyListBox.Requiry

should do the job! You say that the listbox is on a tabbed page on your form.
Unless the listbox is actually on a *subform* on a tabbed page, it is
referenced in the same manner as it would be if all your controls actually
appeared on one screen. If it *is* on a subform, you'd still use requiry, but
you'd have to use syntax that correctly identified the listbox.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
G

Guest

Linq,

It was in a sub form. Thank you so much. I have to go take my meds from
banging my head against the wall.

You collective help is appreciated. Thanks all.

JC
 
S

Shytown_Turk

What would the syntax be to reference a listbox on a subform on a tabbed page?
 
D

Douglas J. Steele

The tab doesn't enter into it. You'd refer to the listbox on the subform the
same as if there wasn't a tab:

Forms!NameOfParentForm!NameOfSubformControlOnParentForm.Form!NameOfListboxOnSubform

or, if doing this from the parent form,

Me!NameOfSubformControlOnParentForm.Form!NameOfListboxOnSubform

Note that the name of the subform control on the parent form isn't always
the same as the name of the form being used as a subform.
 
S

Shytown_Turk

Doug,

Thankyou for the reference, but it is what I was using
(Forms!frmMain!fsubAdm_Sect.Form!lstMacroSec.Requery) and I still am not able
to get the lstbox to update with the new values.

I have a main form (frmMain) that has a tab control with 4 pages (tabs are
hidden, I use command buttons at the top to switch between pages). On one of
these pages I have another tab control with 7 tabs (not hidden). On each of
these tabs I have a subform. My problem is that when a user adds a new
record to the subform (fsubAdm_MacSec) on the first tab, I want a listbox
(lstMacroSec) on another subform (fsubAdm_Sec) on another tab to update its
values and show the new record added. The record source for both subforms is
a straight SQL statement and if I close the application and reopen the lstbox
reflects the record. I am sure it is a timing thing but I can't figure out
which event to use.

Thank you for your assistance. I have used it many times in the past from
your posts for other people as well.

Shaun
 
D

Douglas J. Steele

Do you get an error, or does it just not update?

Are you certain that you're using the name of the subform control on the
parent form? At one point, you say the subform control is named
fsubAdm_Sect, whereas in another place you say it's fsubAdm_Sec.
 
S

Shytown_Turk

Doug,

Thank you for your reply, but that was just a typo. I was trying to use
short names rather than the actual longer ones.

No error message is produced and the control does not update. I have the
following code assigned to the afterupdate event of the text box. It is my
intention that after entering this new record (major item) the end user will
switch tabs where they can now attach a child record to the new major item.
Basically the user switches tabs and selects a value from the drop down box
(major items) and adds a new child record (minor item).

CODE:

Private Sub SectorMacroNm_AfterUpdate()
Forms!frmMain!fsubAdm_Sector.Form!lstMacroSector.Requery
End Sub

Thanks again.
Shaun
 
S

Shytown_Turk

Doug,

I have discovered that if I hit F9 the dropdown list updates and contains
the record added, which makes me believe I am still doing something wrong. I
will keep pluggin away. Thanks for your help.

Shaun
 
D

david12

Doug,

Thankyou for the reference, but it is what I was using
(Forms!frmMain!fsubAdm_Sect.Form!lstMacroSec.Requery) and I still am not able
to get the lstbox to update with the new values.

I have a main form (frmMain) that has a tab control with 4 pages (tabs are
hidden, I use command buttons at the top to switch between pages). On one of
these pages I have another tab control with 7 tabs (not hidden). On each of
these tabs I have a subform. My problem is that when a user adds a new
record to the subform (fsubAdm_MacSec) on the first tab, I want a listbox
(lstMacroSec) on another subform (fsubAdm_Sec) on another tab to update its
values and show the new record added. The record source for both subforms is
a straight SQL statement and if I close the application and reopen the lstbox
reflects the record. I am sure it is a timing thing but I can't figure out
which event to use.

Thank you for your assistance. I have used it many times in the past from
your posts for other people as well.

Shaun

Shaun,
You need to requery the list after the data has been saved.
So, try this.
In the Form_AfterUpdate event of the form behind the fsubAdm_MacSec
subform, put the following:
Parent.subAdm_Sector.Form!lstMacroSector.Requery

In more detail:
1. Open up the fsubAdm_MacSec subform as a form in design view.
2. In the properties window for the form, go to the Events tab.
3. In After Update, set it to [Event Procedure] and click on the
little 3-dots button.
4. Then type in the above statement so that it looks like this:
Private Sub Form_AfterUpdate()
Parent.subAdm_Sector.Form!lstMacroSector.Requery
End Sub

Does that do it?
David Stelle, Access App Developer
 
S

Shytown_Turk

David,

Thanks for the assistance. I finally just moved my update code to the
change event on the tabs and cleaned up the combo boxes. My issues were
related to the control source in the cbos.

Happy Holidays
Shaun

david12 said:
Doug,

Thankyou for the reference, but it is what I was using
(Forms!frmMain!fsubAdm_Sect.Form!lstMacroSec.Requery) and I still am not able
to get the lstbox to update with the new values.

I have a main form (frmMain) that has a tab control with 4 pages (tabs are
hidden, I use command buttons at the top to switch between pages). On one of
these pages I have another tab control with 7 tabs (not hidden). On each of
these tabs I have a subform. My problem is that when a user adds a new
record to the subform (fsubAdm_MacSec) on the first tab, I want a listbox
(lstMacroSec) on another subform (fsubAdm_Sec) on another tab to update its
values and show the new record added. The record source for both subforms is
a straight SQL statement and if I close the application and reopen the lstbox
reflects the record. I am sure it is a timing thing but I can't figure out
which event to use.

Thank you for your assistance. I have used it many times in the past from
your posts for other people as well.

Shaun

Shaun,
You need to requery the list after the data has been saved.
So, try this.
In the Form_AfterUpdate event of the form behind the fsubAdm_MacSec
subform, put the following:
Parent.subAdm_Sector.Form!lstMacroSector.Requery

In more detail:
1. Open up the fsubAdm_MacSec subform as a form in design view.
2. In the properties window for the form, go to the Events tab.
3. In After Update, set it to [Event Procedure] and click on the
little 3-dots button.
4. Then type in the above statement so that it looks like this:
Private Sub Form_AfterUpdate()
Parent.subAdm_Sector.Form!lstMacroSector.Requery
End Sub

Does that do it?
David Stelle, Access App Developer
 

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