Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery 1

Status
Not open for further replies.

RufussMcGee

Technical User
Jan 7, 2005
117
US
Have a problem requery a subform from another subform.

Have a form with two subform attached "Alpha" and "Beta", the users selections a button from subform alpha but beta is not refresh the new new information. If I make a button to refresh the subform beta then the information is there. I must not be typing in a code right or something to allow one subform to refresh another. please help.
 
Ok, Let me see if I understand this. You have a form with 2 subforms. The user is changing data on Subform1 and then you want the data to refresh on subform 2, correct ?

What is the code you are using to refresh the form ?



Remember when... everything worked and there was a reason for it?
 
that is correst

I put this code on a button selection in the 1st subform "Alpha" to refresh the 2nd subform "Beta"

DoCmd.Requery "Beta
 
Try
Forms!MainFormName!SubformNameWhichYouWantToRefresh.Refresh

You shouldn't need a button. You can do this after update or whatever. Hitting a button can be a pain in the neck.

How many fields are on the subform which need to refresh the other form ?

Remember when... everything worked and there was a reason for it?
 
Replace this:
DoCmd.Requery "Beta"
with this:
Me.Dirty = False
Me.Parent!Beta.Form.RecordSource = Me.Parent!Beta.Form.RecordSource

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
No go...

Forms!MainFormName!SubformNameWhichYouWantToRefresh.Refresh

type out Forms!Beta!subfrmMYList.Refresh

the error 'Object doesn't support this propert or method'
---------------------------------------------------------
Me.Dirty = False
Me.Parent!Beta.Form.RecordSource = Me.Parent!Beta.Form.RecordSource

type out

Me.Dirty = False
Me.Parent!Beta.Form.subfrmMYList = Me.Parent!Beta.Form.subfrmMYList

the error 'You entered an expession that has an invalid reference to the property Dirty'

Did I Mistype something or forget to do something?



 
Is this an ADP or MDB ? Beta is the name of your main form? In your original post you said Beta was the name of your subform.
Please give me the actual names of the main form and subforms.
Thank you

Remember when... everything worked and there was a reason for it?
 
Okay changes things around to Beta is now my primary form been rewriting it to try different things to make this work. I have two subforms, subfrmMYList and subfrmCONTACT. I want to select the name from subfrmMYList which is linked back to my query. To refresh the query of the subfrmCONTACT.

For example I saw this in a program called Maximizer. You select the customer then you can select who ever your contact is. One Customer might holds quite a few different names.

Thanks
 
ADP or MDB ???????

Remember when... everything worked and there was a reason for it?
 
Also, what event are you using to perform the code ?

Remember when... everything worked and there was a reason for it?
 
Lets start from the beginning....
Assuming ADP is SQL Server database (not using).

On one subform I have a the alphabet list in button format. You click a letter then changes a label to that letter which in turn changes my query to show only data that starts with that letter. The subform that is tied to the query needs to requery or refresh to show that correct data. If I have a button by itself on the main form I with this code it will refresh

DoCmd.Requery "subfrmContact".

I do not want to have to click another button. Does that make sense?
 
Try this syntax.

Forms!Orders!OrderDetails.Form.requery

Remember when... everything worked and there was a reason for it?
 
YES!!! Perfect thanks for taking the time to figure out my probelm.
 
Sorry it took so long. Access is tricky a lot of times. Sometimes code works one way but not the other way.



Remember when... everything worked and there was a reason for it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top