Prev: Setting a Combo box value from a previous form
Next: Listbox w/many columns, need update all columns to table
From: Dirk Goldgar on 9 Feb 2010 09:22 ".Len B" <gonehome(a)internode0.on0.net> wrote in message news:uBnExhWqKHA.5940(a)TK2MSFTNGP02.phx.gbl... > THE PROBLEM. > In addition to using the provided 'Save' button, users are able to > save incomplete/inappropriate detail records by exiting to the main > form (say by clicking cmdPrint or cmdClose). The BeforeUpdate code > doesn't fire and the record isn't validated and the user isn't warned. > [...] > Am I correct saying that the subform BeforeUpdate does not fire in the > circumstances described? No. The subform's BeforeUpdate event should fire, and I have never heard of a case where it did not, if correctly established. Check to make sure that, in the property sheet of the form that is displayed by the subform control, on the Event tab, the Before Update property is set to "[Event Procedure]". -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup)
From: .Len B on 9 Feb 2010 18:29 The subform control on the main form has only Enter & Exit events. The Exit event has only a DoEvents statement which I inserted just to have somewhere to set a breakpoint. This event does fire. The BeforUpdate event does have[Event Procedure] in the property sheet. In fact the event does fire if I click on the cmdSave within the subform but does not fire when leaving the subform by another way, hence the wording of the subject line. I just now tested by setting an exit event on one of the subform controls and single stepping. I clicked on the cmdClose button of the main form from within said control. OnExit fired, form closed, incomplete detail record was saved without validation. Just had a thought. I'll do a decompile / compile. Who knows? -- Len ______________________________________________________ remove nothing for valid email address. "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message news:4C49D2A8-24CB-491D-9FE8-1E422BA4B551(a)microsoft.com... | ".Len B" <gonehome(a)internode0.on0.net> wrote in message | news:uBnExhWqKHA.5940(a)TK2MSFTNGP02.phx.gbl... | > THE PROBLEM. | > In addition to using the provided 'Save' button, users are able to | > save incomplete/inappropriate detail records by exiting to the main | > form (say by clicking cmdPrint or cmdClose). The BeforeUpdate code | > doesn't fire and the record isn't validated and the user isn't warned. | > [...] | > Am I correct saying that the subform BeforeUpdate does not fire in the | > circumstances described? | | No. The subform's BeforeUpdate event should fire, and I have never heard of | a case where it did not, if correctly established. | | Check to make sure that, in the property sheet of the form that is displayed | by the subform control, on the Event tab, the Before Update property is set | to "[Event Procedure]". | | -- | Dirk Goldgar, MS Access MVP | Access tips: www.datagnostics.com/tips.html | | (please reply to the newsgroup) |
From: Jeanette Cunningham on 10 Feb 2010 00:27 Ah Hah! Use the before update event on the form that you put inside the subform control. This explains the strange results you were getting. It's not the subform control where you validate data, it's the form (subform) inside the subform control. Sometimes both the subform and the subform control have the same name, sometimes they don't. By the way, it's best not to use exit events of controls to validate data - causes problems and is best avoided. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia ".Len B" <gonehome(a)internode0.on0.net> wrote in message news:%23D1wS$dqKHA.4492(a)TK2MSFTNGP05.phx.gbl... > The subform control on the main form has only Enter & Exit events. > The Exit event has only a DoEvents statement which I inserted just > to have somewhere to set a breakpoint. This event does fire. > > The BeforUpdate event does have[Event Procedure] in the property > sheet. In fact the event does fire if I click on the cmdSave > within the subform but does not fire when leaving the subform > by another way, hence the wording of the subject line. > > I just now tested by setting an exit event on one of the subform > controls and single stepping. I clicked on the cmdClose button of > the main form from within said control. OnExit fired, form closed, > incomplete detail record was saved without validation. > > Just had a thought. I'll do a decompile / compile. Who knows? > > -- > Len > ______________________________________________________ > remove nothing for valid email address. > "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message > news:4C49D2A8-24CB-491D-9FE8-1E422BA4B551(a)microsoft.com... > | ".Len B" <gonehome(a)internode0.on0.net> wrote in message > | news:uBnExhWqKHA.5940(a)TK2MSFTNGP02.phx.gbl... > | > THE PROBLEM. > | > In addition to using the provided 'Save' button, users are able to > | > save incomplete/inappropriate detail records by exiting to the main > | > form (say by clicking cmdPrint or cmdClose). The BeforeUpdate code > | > doesn't fire and the record isn't validated and the user isn't > warned. > | > [...] > | > Am I correct saying that the subform BeforeUpdate does not fire in > the > | > circumstances described? > | > | No. The subform's BeforeUpdate event should fire, and I have never > heard of > | a case where it did not, if correctly established. > | > | Check to make sure that, in the property sheet of the form that is > displayed > | by the subform control, on the Event tab, the Before Update property is > set > | to "[Event Procedure]". > | > | -- > | Dirk Goldgar, MS Access MVP > | Access tips: www.datagnostics.com/tips.html > | > | (please reply to the newsgroup) > | > > >
From: .Len B on 10 Feb 2010 00:41 I hadn't done a decompile before so I didn't know what to expect. It appears similar to a Compact but when I open the VB code, Clicking Debug shows Compile greyed out. Did the decompie work? I did it twice. In any case, I can still save an unvalidated detail record. -- Len ______________________________________________________ remove nothing for valid email address. ".Len B" <gonehome(a)internode0.on0.net> wrote in message news:%23D1wS$dqKHA.4492(a)TK2MSFTNGP05.phx.gbl... | The subform control on the main form has only Enter & Exit events. | The Exit event has only a DoEvents statement which I inserted just | to have somewhere to set a breakpoint. This event does fire. | | The BeforUpdate event does have[Event Procedure] in the property | sheet. In fact the event does fire if I click on the cmdSave | within the subform but does not fire when leaving the subform | by another way, hence the wording of the subject line. | | I just now tested by setting an exit event on one of the subform | controls and single stepping. I clicked on the cmdClose button of | the main form from within said control. OnExit fired, form closed, | incomplete detail record was saved without validation. | | Just had a thought. I'll do a decompile / compile. Who knows? | | -- | Len | ______________________________________________________ | remove nothing for valid email address. | "Dirk Goldgar" <dg(a)NOdataSPAMgnostics.com.invalid> wrote in message | news:4C49D2A8-24CB-491D-9FE8-1E422BA4B551(a)microsoft.com... || ".Len B" <gonehome(a)internode0.on0.net> wrote in message || news:uBnExhWqKHA.5940(a)TK2MSFTNGP02.phx.gbl... || > THE PROBLEM. || > In addition to using the provided 'Save' button, users are able to || > save incomplete/inappropriate detail records by exiting to the main || > form (say by clicking cmdPrint or cmdClose). The BeforeUpdate code || > doesn't fire and the record isn't validated and the user isn't | warned. || > [...] || > Am I correct saying that the subform BeforeUpdate does not fire in | the || > circumstances described? || || No. The subform's BeforeUpdate event should fire, and I have never | heard of || a case where it did not, if correctly established. || || Check to make sure that, in the property sheet of the form that is | displayed || by the subform control, on the Event tab, the Before Update property is | set || to "[Event Procedure]". || || -- || Dirk Goldgar, MS Access MVP || Access tips: www.datagnostics.com/tips.html || || (please reply to the newsgroup) ||
From: .Len B on 10 Feb 2010 02:19 I'm sorry Jeanette, you've lost me. I have a main form, frmEnterNotes containing a subform control called subfrmNote. Inside the subfrmNote control is the subform called subfrmNoteNow. subfrmNoteNow has the BeforeUpdate event where my posted validation code lives. This code runs fine if I deliberately try to save the detail record from within the subform using cmdSave. The record is validated, saved and a new blank record is presented ready to enter another note for this parent record. It is only if I do not complete the subform normally that the problem arises. Example, If I do anything outside the subform, the validation code is somehow bypassed and the record is saved regardless of its validity. I think what you are saying is what I am doing. If not please say what I should do. I only used the Exit event to provide somewhere to put a DoEvents to set a breakpoint. That will go; no point to it. -- Len ______________________________________________________ remove nothing for valid email address. "Jeanette Cunningham" <nnn(a)discussions.microsoft.com> wrote in message news:Ouno3HhqKHA.728(a)TK2MSFTNGP04.phx.gbl... | Ah Hah! Use the before update event on the form that you put inside the | subform control. | This explains the strange results you were getting. | It's not the subform control where you validate data, it's the form | (subform) inside the subform control. | Sometimes both the subform and the subform control have the same name, | sometimes they don't. | | By the way, it's best not to use exit events of controls to validate data - | causes problems and is best avoided. | | | Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Setting a Combo box value from a previous form Next: Listbox w/many columns, need update all columns to table |