Bind popup fails on move to other record

BarryMK

4 strings are enough
Local time
Today, 11:44
Joined
Oct 15, 2002
Messages
1,349
Hello Good People

I have this piece of code which opens a popup form from a command button on form 1. The standard link criteria bind the popup to the record showing on form 1 (field ID) is the PK. So far so good. Problem is that now when I move to a different record on form 1, the binding fails and the resulting popup is not related to the record. Am I missing a refresh, requery or similar here? Is the save record command wrongly placed perhaps?


Private Sub CmdOpenEffReview2_Click()
Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.RunCommand acCmdSaveRecord
stDocName = "EffectivenessReview"

stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OpenEffReview2_Click:
Exit Sub

Err_OpenEffReview2_Click:
MsgBox Err.Description
Resume Exit_OpenEffReview2_Click
End Sub
 
Instead of including the LinkCriterion on the OpenForm call, maybe you should refresh the popup's Filter in the popup's OnOpen and OnGotFocus events, e.g.,

Me.Filter = Forms.frmCallerOfMe.txtID
Me.FilterOn = True

If the popup is supposed to hang out somewhere on the screen while the user fools with form 1, maybe you need to put something like

Forms.frmCalledByMe.Requery

in the form 1 AfterUpdate event code.

Jim
 
Thanks Jim

I've been off for a couple of days and I'll take a look at your suggestion a soon as I have an Access moment.
 
Thanks Mile. Likewise when I get that Access moment after I've finished catching up on everything else in my in tray.......
 

Users who are viewing this thread

Back
Top Bottom