Prev: Setting a Combo box value from a previous form
Next: Listbox w/many columns, need update all columns to table
From: Jeanette Cunningham on 10 Feb 2010 00:59 When Compile is greyed out, all the code is compiled. Once you start to edit some of the code, it will become uncompiled. We usually click Debug | Compile every time we make a change to some code. Then we always click Save to save the code. Or you can do it in the reverse order. Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia ".Len B" <gonehome(a)internode0.on0.net> wrote in message news:elLAGPhqKHA.3408(a)TK2MSFTNGP06.phx.gbl... >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: Jeanette Cunningham on 10 Feb 2010 05:44 I haven't come across this situation before. If you set a break point on the subform's before update event in the code window, open the form in normal view, do enough data entry to make the subform dirty and leave a required field empty, then click back on the main form, does the code window open and allow you to step through the before update event for the subform? Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia ".Len B" <gonehome(a)internode0.on0.net> wrote in message news:%23k%233zFiqKHA.5940(a)TK2MSFTNGP02.phx.gbl... > 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 > > >
From: .Len B on 10 Feb 2010 05:46 I was surprised to see that the code was compiled after I had just done a decompile. I wondered if it really did decompile. -- Len ______________________________________________________ remove nothing for valid email address. "Jeanette Cunningham" <nnn(a)discussions.microsoft.com> wrote in message news:OCE7J1jqKHA.5736(a)TK2MSFTNGP05.phx.gbl... | When Compile is greyed out, all the code is compiled. | Once you start to edit some of the code, it will become uncompiled. | We usually click Debug | Compile every time we make a change to some code. | Then we always click Save to save the code. | Or you can do it in the reverse order. | | | Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia | | | ".Len B" <gonehome(a)internode0.on0.net> wrote in message | news:elLAGPhqKHA.3408(a)TK2MSFTNGP06.phx.gbl... | >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.
From: Jeanette Cunningham on 10 Feb 2010 05:55 Here is my decompile procedure. However it is quite a long time since I have needed to do a decompile. Here is my decompile procedure... ----start of decompile notes----------- Open Access normally and Compact Open with Decompile switch, then close Open Access normally and compact again Do a compile and save all Compact again All of the above on a *copy* of the file. If all goes well I replace the original with the copy. To decompile, I usually go via Start => Run... "C:\Program Files\...etc...\MSACCESS.EXE" /decompile "C:\MyFolder\MyDb.mdb" After this, compile again. Steve Schapel "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" A shortcut named something like Access Decompile can be created one time, and then used to open any database. A database that you open with this shortcut will be decompiled. For example, I have three such shortcuts that I created for my PC, since I have Access 97, 2000 and 2002 loaded on my machine. I find this a lot easier than typing out the path in the Start => Run... dialog each time. Name: Access 97 Decompile Target: "C:\Program Files\Microsoft Office 97\Office\msaccess.exe" /decompile Name: Access 2000 Decompile Target: "C:\Program Files\Microsoft Office 2000\Office\msaccess.exe" /decompile Name: Access 2002 Decompile Target: "C:\Program Files\Microsoft Office XP\Office10\msaccess.exe" /decompile "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" /decompile --------------------------- Tom Thanks a lot, Tom, for this good suggestion. However, I personally don't "type out the path in the Start => Run... dialog each time". I just select the item I want from the combobox on the Start => Run dialog. :-) -- Steve Schapel, Microsoft Access MVP I tend to use the Clear button on the Advanced tab of the Taskbar and Start Menu Properties dialog fairly often. Call me paranoid, but I don't like to leave snail trails that others can use to snoop around and see what I've been up to. So, in my case, that would mean having to retype it each time (or search for the correct version of msaccess.exe and drag-n-drop it onto the Start => Run dialog. Tom --end of decompile notes----------- ".Len B" <gonehome(a)internode0.on0.net> wrote in message news:%23356d5jqKHA.4604(a)TK2MSFTNGP05.phx.gbl... >I was surprised to see that the code was compiled after I had just > done a decompile. I wondered if it really did decompile. > > -- > Len > ______________________________________________________ > remove nothing for valid email address. > "Jeanette Cunningham" <nnn(a)discussions.microsoft.com> wrote in message > news:OCE7J1jqKHA.5736(a)TK2MSFTNGP05.phx.gbl... > | When Compile is greyed out, all the code is compiled. > | Once you start to edit some of the code, it will become uncompiled. > | We usually click Debug | Compile every time we make a change to some > code. > | Then we always click Save to save the code. > | Or you can do it in the reverse order. > | > | > | Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia > | > | > | ".Len B" <gonehome(a)internode0.on0.net> wrote in message > | news:elLAGPhqKHA.3408(a)TK2MSFTNGP06.phx.gbl... > | >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. > > >
From: .Len B on 10 Feb 2010 06:15 No. It doesn't fire. I have breakpoints everywhere trying to figure where its going. That's why I put the breakpoint in txtbox exit event. Code window opens and I single step through. The txtbox's exit fires, the subform control's exit event fires and then the click event of a cmd button on the main form fires. Record is now saved. Subform was certainly dirty. I cannot click on a txtbox or cbo of main form. They are all locked. I should say that no fields are 'required' at the table level; validation intended to happen in BeforeUpdate code. -- Len ______________________________________________________ remove nothing for valid email address. "Jeanette Cunningham" <nnn(a)discussions.microsoft.com> wrote in message news:eurFR4jqKHA.728(a)TK2MSFTNGP04.phx.gbl... |I haven't come across this situation before. | If you set a break point on the subform's before update event in the code | window, | open the form in normal view, | do enough data entry to make the subform dirty and leave a required field | empty, | then click back on the main form, | does the code window open and allow you to step through the before update | event for the subform? | | | Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia | | | ".Len B" <gonehome(a)internode0.on0.net> wrote in message | news:%23k%233zFiqKHA.5940(a)TK2MSFTNGP02.phx.gbl... | > 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 |