refresh a list on a tabbed subform

JonatABS

Registered User.
Local time
Today, 04:31
Joined
Dec 16, 2002
Messages
114
I have a tab control.

The 4th tab over has a list with a query on a subform.

I gotthesubform to refresh however you need to either create a new record on that subform or click on the list itself.

I want to refresh that form with I click on the 4th tab

The tabcontrol form is named Evaluators and the tab I want this happening in is named Cows.

the subform is named cows subform
the list is called lifetotallist

THanks for any help.
 
Not sure if I understood correctly, but you could add, on the Click event of the tab, one of these lines of code:

cows.requery 'Refresh the subform

or

lifetotallist.requery 'Refresh the list


Hope that it helps you!
 
yeah you have the idea.

The problem is that the form I want to requery is on a subform.
 
Try an expression like this:
Me.[cows subform].Form.lifetotallist.Requery

Generally to do an operation on a subform control when using code from the main form, the expression needs to be like this:
Forms!mainformname!subformname.Form!controlname.Requery
which can be changed to
Me.subformname.Form.control.Requery
if the code is running from the form itself.
 
Awsome, your the first to explain this to me. LOL

THanks alot, ill give that a shot
 
this still isnt working though.

usually if it will work. After you put the last period for the statement and you start to type requery the menu would pop up showing you it found the statement.

I decided to use the afterupdate property of the employee number from the first tab to update the list on the last tab.

All I want is to requery a list on a subform. In theory then, when I go to that tab it should already be requeryed right?
 
Requery a Subform

I wonder if this thread is talking XP or an earlier version. My problem lies with XP.

I agree with DC693's syntax "Forms!mainformname!subformname.Form!controlname.Requery"

but XP is returning the Run-Time error 2465 and "can't find the field <subformname>

My code line is:

Forms![frmMember_Inactive]![frmMember_Inactive-sub].recordsource.requery

I could swear that this worked just fine in Access97! Any help advice is most appreciated!
 
I found my answer but not without some pain. I converted the XP back to 97, moved it to my 97 PC and ran it. Same error. Now I have become convinced it is an error.

I was using the name of the subform as entered into the Database Window/Forms pane. But what access wanted was the Caption name of the subform. I have generally changed this from the object name because its display confuses the users.

When I renamed the subform with the Caption property name, the simple code: <subform caption name>.Requery ran just find.

Now, I honestly do not understand why Microsoft designed it this way but perhaps this will help JonatABS as well.

If there are any MVPs out there, I'd be curious as to the logic behind this. And dear Lord, I hope I remember this for future reference!
 
Because a subform when used on a main form becomes a control on the main form, you therefore have to refer to the control name as shown on the property sheet of the main form, not the name of the subform as shown in the db window.
If you open the main form in design view you can use the builder to build the correct references
 
I see, itwasn't the caption but the Name property of the subform as seen from within the Main Form. That makes me feel a lot better.

Thanks, Rich!
 
damn now im REALLY confused.

the first tab has an employee number on it. When I cycle through the employees I want to then be able to go to the other tab that shows yearly totals for that employee. I have on that subform where the list is an OK button. When I press that button I get a new record to put in for a new year and it updates the list like it should.

I want that list to update whenever I change to a new employee on the first tab.

ITS not doing that.

I tried all y our suggestions but its not working. I put the code on the AFTERUPDATE event of the employee number that gets changed whenever I cycle through the records.

I hope this is understandable :-)
 
Bump.

Im hoping someone knows this LOL

Again im trying to refresh a list control on a subform, located on a tab.

I want that list to requery as I go through the records on the 1st tab(employee information, including employee ID), under the afterupdate propertie of the employee number.

That way if I decide to go to the tab with the list, it will have already been requiried and refreshed and I will see the complete list.
Thanks for the help fellas, i know im digging into this, but someone has to pick brains LOL
 
JonatABS,

There certainly a parallel with our problems. We have a form and a subform that aren't talking. You have the addition of the tab to contend with. Well here are some thoughts.

The first easy question to ask is have you used the Builder tool? It was with it that I discovered my glitch.

Another thing that might help, provides reassurance, is to create a query for what you want to happen based on the loaded forms controls. When you start tabbing through, you can drop back and run the query. If the query shows changes through the AfterUpdate event that's pretty cool.

Why the AfterUpdate? Why not on the OnChange and perhaps a query to set it when the form OnOpens? You have to change data to leverage AfterUpdate.

By the by, I still can't find the builder from the code window but can sneak through via a query design and somewhere else. My radio buttons and check boxes would not work today. Maybe it is my mind and not XP......
 
still looking :-)

man. this really sucks.

what is the syntax to use the onchange property to do this.

tab form
onchange property for the employee # on first tab
requery a list (based on a query of course)
that list is on a sub form
that subform is on another tab
the tab has a recordset same as the tab that the employee number is on.


There was a suggestion to put
me![tab name].requery

the system lets me do that but it doesnt update the list.
The list still shows the old data
it will show the new data when I press a button on the subform to requery though.

if I need to send the program to someone I would be happy to. Im sure alot of ppl would love to know how to do this.
 
JonatABS,

I think it would be a good thing to put out a file to this forum with the bare essentials. Note in the code where it is failing. Keep it simple and note the Access version.
 

Users who are viewing this thread

Back
Top Bottom