How can I refresh my table data?

  • Thread starter Thread starter Pamela
  • Start date Start date
P

Pamela

I have sfrmInspLoc based on tblInspLoc and apparently the table doesn't
update as fast as necessary to handle a popup form, pfrmInspLocRep, with the
OpenArgs property set to carry the InspLocID field across from sfrmInspLoc to
pfrmInspLocRep. The tblInspLoc has PK field InspLocID field and is
Autonumber. On the popup form it isn't key and is Integer. Right now, the
popup form opens, the ID field OpenArgs carries through and I can update the
popup, but when I try to close it, I get an error that the system can't find
the matching ID record in tblInspLoc. If I close out of sfrmInspLoc and
reopen, the popup works fine. Is there a way to have table update faster or
refresh before the AfterUpdate event of my combo? Thanks for any help!
 
Unfortunately, I had already checked Microsoft help but was unable to find
the code procedure for refreshing. But for anyone else that may be
searching, by trial and error I found that adding the line: Me.Refresh to my
code, before the DoCmd.OpenForm line seemed to fix the problem. Thanks!
 
I have sfrmInspLoc based on tblInspLoc and apparently the table doesn't
update as fast as necessary to handle a popup form, pfrmInspLocRep, with the
OpenArgs property set to carry the InspLocID field across from sfrmInspLoc to
pfrmInspLocRep. The tblInspLoc has PK field InspLocID field and is
Autonumber. On the popup form it isn't key and is Integer. Right now, the
popup form opens, the ID field OpenArgs carries through and I can update the
popup, but when I try to close it, I get an error that the system can't find
the matching ID record in tblInspLoc. If I close out of sfrmInspLoc and
reopen, the popup works fine. Is there a way to have table update faster or
refresh before the AfterUpdate event of my combo? Thanks for any help!

What's probably happening is that the record is visible on the calling form
but has not yet been written into the table. Put a line in the code before you
open the popup form to explicitly save the record in the calling form. Either
of these will work:

DoCmd.RunCommand acCmdSaveRecord

or

If Me.Dirty Then Me.Dirty = False
 
Back
Top