| Author |
Linked Table in MS Access shows prior data
|
|
| donaldmaloney 2005-05-10, 9:46 pm |
| In MS access I have a form that I select a code.
Depending on th ecode The subform displays the data in the table.
When I change the code I un link the old table with a Docmd call and link the new table with a Docmd call.
The subform shows the data from the first table.
but if I look at the Tables page and click on the table that links to the new data the new data is displayed.
If I get out of the form and come back in without changing the code the subform now shows the correct data.
I have done .requery and .refresh but that doesnt solve the problem.
Help | |
| OldManRiver 2005-09-08, 10:09 am |
| quote: Originally posted by donaldmaloney
In MS access I have a form that I select a code.
Depending on th ecode The subform displays the data in the table.
When I change the code I un link the old table with a Docmd call and link the new table with a Docmd call.
The subform shows the data from the first table.
but if I look at the Tables page and click on the table that links to the new data the new data is displayed.
If I get out of the form and come back in without changing the code the subform now shows the correct data.
I have done .requery and .refresh but that doesnt solve the problem.
Help
The unlink/relink is not important or necessary. What is necessary is:
me.recordsource = SQLstatement
where SQLstatment shows the actual data you want to see on the form from a SQL "SELECT" statement.
Then .requery and .refresh will work.
OMR | |
| donaldmaloney 2006-09-17, 3:52 pm |
| Actually what was necessary was to put in code at the start of the ON change event whih deleted table links, reset new table links and requeried the subform.
Me.NAMEOFSUBFORM.SourceObject = ""
Which pulls the subform link off of the main form
Then I delete table links ,which create the query to the subform.
Then I link to the tables referencing the correct files.
Then use the statement
Me.NAMEOFSUBFORM.SourceObject = "NAMEOFSUBFORM"
Which on requery now uses the correct tables and the subform displays correctly.
What I think was happening is Access when it opens a form or subform with a recordsource saves that recordsource as a clone table.
With the reseting of the name to blank and top itself the clone Table goes away and on requery a new one is created.
At least this works for me.
B][/QUOTE] |
|
|
|