A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Update listbox on a tab



 
 
Thread Tools Display Modes
  #1  
Old January 9th, 2008, 03:29 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 17
Default Update listbox on a tab

Hi,

I have a tabcontrol on a form that contains two tabs. The first tab
is used to enter new projects into a table. On the second tab I am
using a listbox to view the projects, the problem that I am having is
that when the new records are added into the table from the first tab
the listbox only updates with the new record when I close and reopen
the form. I tried using the code below to requery the data when the
tabs are changed but it's not working and I am only a novice at VBA so
I don't even know if it is right. Please help, below is the code I
was using to updated the listbox. Thanks

Private Sub TabCtl_MngProjects_Change()
List17.Requery
End Sub
  #2  
Old January 9th, 2008, 04:17 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Update listbox on a tab

Try this:

Private Sub TabCtl_MngProjects_Change()
me.tabctl.pages("pagename").controls.item("List17" ).Requery
End Sub

Where Pagename is the name of your second tab. You can also set the
pageindex number which will prob. be 1 or 2. In that case don't put quotes
around it.

hth
--
Maurice Ausum


" wrote:

Hi,

I have a tabcontrol on a form that contains two tabs. The first tab
is used to enter new projects into a table. On the second tab I am
using a listbox to view the projects, the problem that I am having is
that when the new records are added into the table from the first tab
the listbox only updates with the new record when I close and reopen
the form. I tried using the code below to requery the data when the
tabs are changed but it's not working and I am only a novice at VBA so
I don't even know if it is right. Please help, below is the code I
was using to updated the listbox. Thanks

Private Sub TabCtl_MngProjects_Change()
List17.Requery
End Sub

  #3  
Old January 9th, 2008, 04:36 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 17
Default Update listbox on a tab

On Jan 9, 10:17*am, Maurice wrote:
Try this:

Private Sub TabCtl_MngProjects_Change()
* * *me.tabctl.pages("pagename").controls.item("List17 ").Requery
End Sub

Where Pagename is the name of your second tab. You can also set the
pageindex number which will prob. be 1 or 2. In that case don't put quotes
around it.

hth
--
Maurice Ausum



" wrote:
Hi,


I have a tabcontrol on a form that contains two tabs. *The first tab
is used to enter new projects into a table. *On the second tab I am
using a listbox to view the projects, the problem that I am having is
that when the new records are added into the table from the first tab
the listbox only updates with the new record when I close and reopen
the form. *I tried using the code below to requery the data when the
tabs are changed but it's not working and I am only a novice at VBA so
I don't even know if it is right. *Please help, below is the code I
was using to updated the listbox. Thanks


Private Sub TabCtl_MngProjects_Change()
* * List17.Requery
End Sub- Hide quoted text -


- Show quoted text -


Works Great! thanks for your help!
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.