SubForm is not updating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform that is in a loacted in my form. The data for the subform
comes from a query that I have created and the query is from a table.

The process is I open the Main form and a Delete Query runs deleting all
data in my table. When I enter the values using combo boxes in my main form,
calculations are done which then are appended to this table. Then my SubForm
query runs which should populate the subform, but doesn't. I use a
docmd.requery "SubFormName" and nothing.

The strange thing is when I close and then reopen the form the subform has
data, but should be blank since I ran a Delete Query on form load. When I
requery this the subform updates to no records. Then when I run my
calculations, populate the source table and run requery nothing happens.
But... then when I close the form reopen again the data is there that should
have appeared before when requery.

What is going on with this subform? I know the data is there but not
showing up in the subform.
 
Hi Matt,
Basically your code is running well but your form needs to be refreshed. To
do that , two solutions:
Close the form and reopen it directly by using the same event... so in the
end of your code you need to write :

DoCmd.Close ac Form, "Your Form"
DoCmd.OpenForm"Your Form"

Or, you need to make sure that your code looks like this:

Dcmd.Echo False
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSaveRecord

DoCmd.OpenQuery "Your ActionQuery",acViewNormal,acEdit

DoCmd.Requery
DoCmd.Echo True

This code is the basic code used to run an action query such as an append or
a delete query.

Sorry, but i am French so let me know if you didn't understand everything.
 
I tried runnning the code below and it did not work. I don't think I have
to rerun the Action Query because I checked and it runs when I hit my Go
button, however the SubForm still does not update. My Action Query is called
"Digging_GapOutput_Append.qry", which appends to the table called
"Digging_GapOutput.tbl". Then I have the query called "Digging_SubForm.qry"
which queries from the data in "Digging_GapOutput.tbl".
The subform uses "Digging_SubForm.qry". You are right about closing then
reopening but that a solution I can use. Also when I click GO in the Main
form and the subform does not update, I went and opened the actual subform in
FORM views and the correct data is there, but not updated in the MAIN form.
 
My Source Object is set to "Digging_SubForm.qry", which is the query that
conatins the data that I need in the subform. I have nothing in my child and
master link fields. What else could be wrong?
 
Back
Top