Update listbox on a tab

J

jseger22

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
 
M

Maurice

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
 
J

jseger22

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







- Show quoted text -

Works Great! thanks for your help!
 

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