Senin, 21 April 2014

[MS_AccessPros] Re: Simulating the before update event

 

John
That did the trick. I think I am getting a better understanding how some of the events happen.  Between what I have asked and others, the education from the MVPs is fantastic.  Thanks for your help.
Rod



---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Rod-

It looks like you're setting values in the "current" row in the frmProtest subform.  That won't fire the BeforeUpdate for those controls, but you should see the subform's BeforeUpdate event fire when something happens to force the record to save - something like moving to another row or moving the focus out to the outer form or another subform.  Note that the save on changing focus won't happen unless the subform has the focus.  Try adding Me.frmProtest.SetFocus before setting the values.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Apr 21, 2014, at 1:21 PM, <desertscroller@...> <desertscroller@...> wrote:

Good Morning John,
The controls are bound to the protest table.  The following is the code I use to set two values when selecting the protest tab.

  Select Case Me.TabCtl_SubForms.Value
   (other case statement here)
    Case conTabCtrl_Protest
     If IsNull(Me.frmProtest!Tbox_BillingNum.Value) Or (Me.frmProtest!Tbox_BillingNum.Value = "") Then
         Me.frmProtest!Tbox_BillingNum = Me.Billing!Tbox_BillingNum
         Me.frmProtest!Tbox_DateProtestRecd = Me.Billing!Tbox_DateProtested
     End If
  End Select

When I leave the tab and go to another tab, the event does not fire but does when I re-enter the tab or when the parent form is moved to the next record.
Rod

---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Rod-

If you truly "dirty" some fields in the current record in code, the BeforeUpdate event of the form should fire when the user moves off the row.  What does your code look like that "updates" the controls?  Are the controls bound?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Apr 21, 2014, at 2:46 AM, <desertscroller@...> <desertscroller@...> wrote:

I have a form where a couple of the controls are updated via VBA code.  If the user makes no other changes on the form ( which is a subform) the before update does not fire.  If the subform is exited and re-entered then it fires or if the parent form is advanced to a new record.  My issue is the user may not remember the changes he made and then select not to update.  I would like to present the update question when the user moves to another subform associated thru tabctrls.  Can this be done very easily?
(Access 2010 on Windows 7 and 8.1)
Rod


__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)
.

__,_._,___

Tidak ada komentar:

Posting Komentar