View Single Post
  #6  
Old July 6th, 2009, 07:05 PM posted to microsoft.public.access
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default "No Current Record" when adding new record

The most likely culprit, I'd guess, is the parent form's BeforeInsert event
procedure as this is executed as soon as the user enters any data into the
form while at a new record. I'd look there for any code which references the
subform, as at this stage the latter's underlying recordset will be empty of
course. If there is such code then make it conditional on:

If Not Me.Newrecord Then

If the culprit is not code in this event procedure look for something similar
elsewhere in the form's module. If you do find something which looks like a
possible suspect then you can of course put a breakpoint in the code and then
step into it line by line with the F8 key when it stops at the breakpoint to
see which line is producing the error.

Ken Sheridan
Stafford, England

TraciAnn wrote:
Clif,

I believe it may have to do with my OnCurrent Event for the form.

I believe you're right grin.


Actually, I think I'm wrong.

It is happening with the creation of the new record on frmFacility but not
having an associated record on fsubTraining.

This doesn't happen on any of my other Form.subForm relationships so I'm not
sure what is causing it.

Any other ideas?

Here's a code snippet I use to test for an empty recordset;


Thanks for the code. I think that will come in handy for several places in
this app.

Just a comment on style (personal preference?) -- if it were my code,
I'd change lines such as


I always appreciate constructive criticism. Good advice...well taken ;-)


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200907/1