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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linked tables have other tables data

Status
Not open for further replies.

donaldmaloney

Programmer
May 15, 2005
10
US
Help.
I open a form and from a combo box select a vendor table.
Once selected I unlink the vendor table and link to the selected vendor table.
Then I open a subform and query the file to display the fields.
When I go back to the first form and select another vendor. The program (DoCmd) unlinks the current vendor table and links to the new vendor.
The subform again through query displays the first vendor's data.
While the forms are still open I go to the TABLES and click on the table that shows a link to the new vendor table and the new vendor data is displayed BUT the subform query is getting data from the first unlinked table.

If I close the forms and restart the correct data displays.

IS there a way to really release the links while the form/sibform is active?

I have used Refresh and requery and Doevents but the data in the tables which are not liked display.

Does the form, when opened, LOCK the currently linked tables so that even if you delete the links and relink to anothrer table the original links remain?

 
Have you refreshed the TableDefs collection after changing the link and before resetting the RecordSource ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
After resetting the liknks I do the following:

CurrentDb.Relations.Refresh
CurrentDb.TableDefs.Refresh
DoEvents


Me.Refresh

Me.Requery

Me.SummarySubform.Form.Requery

Nothing changes the old data shows even with the new links

Don
 
HI,

I got a solution.

Seems the forms lock the tables and links when the form opens.
With yourWordAppObject.Dialogs(wdDialogEditFind)
I created a copy of my subform and called it subformDummy
Thene I
Me.Subform.SourceObject = "SubformDummy"
before I reset the links
and after setting new links I
Me.Subform.SourceObject = "Subform"

And the correct data shows.

Thanks for you help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top