Code Comments
Programming Forum and web based access to our favorite programming groups.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 t he 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 ne w data the new data is displayed. If I get out of the form and come back in without changing the code the subf orm now shows the correct data. I have done .requery and .refresh but that doesnt solve the problem. Help
Post Follow-up to this messagequote: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 S QL "SELECT" statement. Then .requery and .refresh will work. OMR
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 t he 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 ne w data the new data is displayed. If I get out of the form and come back in without changing the code the subf orm now shows the correct data. I have done .requery and .refresh but that doesnt solve the problem. Help
Post Follow-up to this messageActually 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 su bform. 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 correc tly. 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 a way and on requery a new one is created. At least this works for me. B][/QUOTE]
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.