Whew! I think I've got something that appears to be working now! I replaced
the macros in the AfterUpdate event for the Debit and Credit fields with the
following code, which runs as an Event Procedure.
Here is the code for the Debit field:
Private Sub Debit_AfterUpdate()
DoCmd.GoToControl "Balance"
Me.Recalc
DoCmd.GoToControl "Check_Register Subform"
DoCmd.GoToControl "CheckNum"
End Sub
And, here is the code for the credit field:
Private Sub Credit_AfterUpdate()
DoCmd.GoToControl "Balance"
Me.Recalc
DoCmd.GoToControl "Check_Register Subform"
DoCmd.GoToControl "Date"
End Sub
The On Lost Focus event for the cntrol named Balance runs a macro with a
MsgBox Action that has a condition that "checks" for balance less than or
equal to zero, and if that condition is true the message diplays. Should I
replace this by adding an If...Then statement into each of the codes above,
or leave well enough alone now that the "revised" app is working like it
should?
"RC" wrote:
> Here's what I had.
> The After Update event for the Debit field in the subform, Check_Register
> Subform, executes a macro with the following actions:
> 1.) GoToControl --- Control - Balance (a calculated control in the footer of
> the main form, Accounts)
> 2.) SendKeys --- KeyStrokes: {F9} and Wait; Yes
> 3.) GoToControl --- Control - Check_Register Subform
> 4.) GoToControl --- Control - CheckNum
>
> The same was set up for the Credit field in that subform.
> This worked fine in the "original" application, but in the "revised"
> application, which is almost a "carbon copy" of the "original", the focus
> always winds up in the CheckNum field in the first record.
>
> Here's what I've attempted with the Me.Recalc code.
> 1.) The AfterUpdate event in the Debit field executes the same macro, except
> the SendKeys action has been removed.
> 2. When the GoToControl --- Control - Balance executes the OnGotFocus event
> of the Balance field runs the code below:
>
> Private Sub Balance_GotFocus()
> Me.Recalc
> End Sub
>
> 3.) The second GoToControl --- Control - Check_Register Subform executes
>
> 4.) The third GoToControl --- Control - CheckNum executes
>
> With the actions and codes set up in either of the two ways listed above
> inside the "revised" application , the focus is still being returned to the
> CheckNum field in the first record. When the SendKeys action is removed from
> the first "configuration" listed above, or the Me.Recalc code is removed from
> the second "configuration" listed above next, then with either configuration
> the focus will return to the CheckNum field in the last record.
>
> I just tested the Me.Recalc code in the "original" application, and it works
> fine there too, configured in the same way as that second configuration
> listed above. Now to just figure out why the "revised" application is
> behaving differently from the "original" and causing this particular issue.
>
>
> "John W. Vinson" wrote:
>
> > On Mon, 16 Jul 2007 13:08:01 -0700, RC <(E-Mail Removed)> wrote:
> >
> > >Thanks John that looks like it will work as an alternative to that SendKeys
> > >action I had been using, that is, if I can now get an issue resolved here
> > >where to focus is now always returning to the first Account record in the
> > >subform instead of the Account record I'm working with.
> >
> > That sounds like you're Requerying the form (rather than, or instead of,
> > recalculating it). Could you post your code?
> >
> > John W. Vinson [MVP]
> >
|