Why an Insert does not Occur

E

Eka1618

Hello,

I have a form that contains several subforms that are inside a tab control.
I also have other subforms on the parent form in other spots as well.

Usually when I go from one subform to another, an insert occurs. For
instance if I fill in all data in frm1 and move to frm2, an insert into a
table will occur in frm1.

My problem is with the subforms that are inside the tab control. Lets say I
fill in data in frm3 (which is in the tab), and then move back to the parent
for (or any other form for that matter) the insert does not occur.

I am trying to check to see if data was entered in each form before a user
click the send button. I am tracking this by seeing if the AfterInsert event
fired on the subforms. Can anybody tell my why this event does not fire? Does
anyone know? I do not understand why it fires for some subforms and not
others...

Any help would be greatly appreciated, Thank You!
 
E

Eka1618

I do know that using me.dirty = false will force a disk write, but I do not
know when to use this... I have tried using it on form.LostFocus since I am
moving from a subform to another or its parent form, but this is not working.

any suggestions would be great, thank you!
 
J

John W. Vinson

Hello,

I have a form that contains several subforms that are inside a tab control.
I also have other subforms on the parent form in other spots as well.

The tab control is irrelevant in this case - it just manages screen position,
not subform events.
Usually when I go from one subform to another, an insert occurs. For
instance if I fill in all data in frm1 and move to frm2, an insert into a
table will occur in frm1.

Well... not exactly. Setting focus to a subform forces the mainform record to
be saved, if it's dirty; losing focus from a subform forces the subform's
record to be saved, if it's dirty. Neither event will (or should) cause a new
record to be created and inserted.
My problem is with the subforms that are inside the tab control. Lets say I
fill in data in frm3 (which is in the tab), and then move back to the parent
for (or any other form for that matter) the insert does not occur.

I am trying to check to see if data was entered in each form before a user
click the send button. I am tracking this by seeing if the AfterInsert event
fired on the subforms. Can anybody tell my why this event does not fire? Does
anyone know? I do not understand why it fires for some subforms and not
others...

I don't either based on the description. The AfterInsert event fires after the
AfterUpdate event of a subform if the user has entered data into the "new
record"; it will not fire if the user does nothing in the subform. What's the
code in the "Send" button? Each form's BeforeUpdate event can be used to
ensure that the data entered on that form (whether mainform or subform) is
valid; but it sounds like your users may be just skipping over a subform
altogether. The only way to detect this kind of error is to have code in your
button event to (say) do a DLookUp on the child table to see if a record has
been entered; as far as Access is concerned, putting nothing into a subform is
perfectly legitimate and will not cause any event to fire.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top