Re: Subform Requery Doesn't Show Updates to Data

Tech-Archive recommends: Fix windows errors by optimizing your registry



March,

Thanks again for your help, I figured out the problem.

I developed this system so long ago in Access 97 I forgot that I setup the
main for a little unorthodox. I did not bind the main form to a query and I
kept the recordsource propery blank. Since it was an HR system, I didn't
want folks to see records they were supposed to, so I chose not to bind the
form until after they logged in. I kept the main form unbound until the user
selected an option, then I programatically bound the form to a query
recordsource based on their selection.

Looks like Access 97 handled the "late-binding" better than Access 2003. I
just made the change, and bound the main form to a query and sure enough I do
not have the problem with the subform that I was experiencing.

Thanks again for all of your help!! It is greatly appreciated. I was
trying to figure this one out for about a week.

Len

"Marshall Barton" wrote:

Len-DSInc wrote:
Thanks for quick the reply, I tried all of those suggestions, still not
working. Here's the code that I have in the Save and Close commands of my
popup:

Private Sub cmdSave_Click()
Me.Dirty = False
DoCmd.RunCommand acCmdSaveRecord
DBEngine.Idle dbRefreshCache
DoEvents
Me.Requery
Forms![frmemployee_main]![subfrmDayOffVacation].Form.Requery
End Sub

Private Sub cmdClose_Click()
If Me.Dirty Then Me.Dirty = False
DBEngine.Idle dbRefreshCache
DoEvents
Forms![frmemployee_main]![subfrmDayOffVacation].Form.Requery

Is it possible I'm running into a record locking problem since the subform
and the popup are pointing to the same records? I didn't think so since I do
not allow edits or record selectors in the subform. Thanks,


Get rid of the DoCmd.RunCommand acCmdSaveRecord line.
Dirty = False
does the same thing, but is better because you can be sure
which form's record is being saved.

Get rid of the Me.Requery line. I can not see any point to
requerying the popup form.

About the only other idea I have about the delay is maybe
subfrmDayOffVacation is not getting enough time to display
it's records. Maybe adding this after the Requery will
jiggle things into place:

DoEvents
Forms![frmemployee_main]![subfrmDayOffVacation].Form.Repaint
DoEvents

If you do get rid of the delay, be sure to go back and
remove the various things we're trying one at a time to
determine which one, or combination, is effective. You
don't want any useless code that may be consuming resources.

One other stray thought. The delay may be caused by the
subfrmDayOffVacation form's record source returning a large
number of records. If that's the case, try filtering the
query to the minimum number of necessary records.

--
Marsh
MVP [MS Access]

.



Relevant Pages

  • RE: Need to set Filters on a form based on several drop down boxes
    ... can you see something wrong with the SQL statement? ... Private Sub psBuildSQL() ... "Jack Leach" wrote: ... know that saved queries will always run faster than a "built" query. ...
    (microsoft.public.access.modulesdaovba)
  • Re: access 2003
    ... I've noticed is that it seems you should be using a parameter query to ... Dim db As DAO.Database ... then the recordset contains no records: ... Private Sub ChooseCust_AfterUpdate ...
    (microsoft.public.access.conversion)
  • Re: Emailing from a form using recursive query results
    ... A query that uses the retrieves from anothr relation the ... A single Emailaddress is generated for this ... Static myValue as Integer 'I would actually type this as whatever ... Private sub Form_Current ...
    (microsoft.public.access.forms)
  • Re: How to fix Error 2465
    ... Doug Steele, Microsoft Access MVP ... The main query is... ... Private Sub Contact_Type_BeforeUpdate ... I tried your code (though had to put a " in after the [ContactID] to ...
    (microsoft.public.access.formscoding)
  • Re: How to fix Error 2465
    ... Hi Doug - I'm going to sit with this fix for a while and try and nut it out. ... Doug Steele, Microsoft Access MVP ... The main query is... ... Private Sub Contact_Type_BeforeUpdate ...
    (microsoft.public.access.formscoding)