472,146 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Forms Events & Invalid use of Null

Greetings,

It would seem that this topic has been discussed at some length, but I
was unable to discern whether there was a clear cut solution to resolve
and/or otherwise workaround the issue.

Briefly, I have some code which queries the database from a subform,
and enables or disables a contol in the parent form, depending upon the
results I receive.

This seems to be working for post-insert and post-update events.
However, when I connect the code with current and post-delete events,
then I begin receiving the infamous "Invalid use of Null".

Without going into a lot of detail about the code, I am 99.9% confident
the code is not to blame. As I stated, it works without error for
certain events, but just not others. So that begs the question, is
there a more appropriate event I could be handling? I am hoping ther
answer is yes.

The bottom line for me is to detect any change in the state of the
subform's recordset (insert, update, and delete) and report that back
to the parent form in the form of enabled or disabled control Any
insight in this area would be greatly appreciated.

Regards,
Michael

Jun 18 '06 #1
2 1908
Well, I was able to get around it (more or less) by handling the 94
error in my On Error block. I didn't know of any other way to hide this
detail from the user.

Now I am trying to understand the event timing. I have event handlers
for On Current, After Insert, After Update, and After Del Confirm. All
but After Insert are being handled properly.

After Insert does not appear to be firing and I don't know why. This is
important because after a record (first record) has been inserted I
would like for the user interface to disable the parent control.

Any ideas how to workaround this issue?

Mike wrote:
Greetings,

It would seem that this topic has been discussed at some length, but I
was unable to discern whether there was a clear cut solution to resolve
and/or otherwise workaround the issue.

Briefly, I have some code which queries the database from a subform,
and enables or disables a contol in the parent form, depending upon the
results I receive.

This seems to be working for post-insert and post-update events.
However, when I connect the code with current and post-delete events,
then I begin receiving the infamous "Invalid use of Null".

Without going into a lot of detail about the code, I am 99.9% confident
the code is not to blame. As I stated, it works without error for
certain events, but just not others. So that begs the question, is
there a more appropriate event I could be handling? I am hoping ther
answer is yes.

The bottom line for me is to detect any change in the state of the
subform's recordset (insert, update, and delete) and report that back
to the parent form in the form of enabled or disabled control Any
insight in this area would be greatly appreciated.

Regards,
Michael


Jun 18 '06 #2

Mike wrote:
Well, I was able to get around it (more or less) by handling the 94
error in my On Error block. I didn't know of any other way to hide this
detail from the user.

Now I am trying to understand the event timing. I have event handlers
for On Current, After Insert, After Update, and After Del Confirm. All
but After Insert are being handled properly.

After Insert does not appear to be firing and I don't know why. This is
important because after a record (first record) has been inserted I
would like for the user interface to disable the parent control.

Any ideas how to workaround this issue?

Mike wrote:
Greetings,

It would seem that this topic has been discussed at some length, but I
was unable to discern whether there was a clear cut solution to resolve
and/or otherwise workaround the issue.

Briefly, I have some code which queries the database from a subform,
and enables or disables a contol in the parent form, depending upon the
results I receive.

This seems to be working for post-insert and post-update events.
However, when I connect the code with current and post-delete events,
then I begin receiving the infamous "Invalid use of Null".

Without going into a lot of detail about the code, I am 99.9% confident
the code is not to blame. As I stated, it works without error for
certain events, but just not others. So that begs the question, is
there a more appropriate event I could be handling? I am hoping ther
answer is yes.

The bottom line for me is to detect any change in the state of the
subform's recordset (insert, update, and delete) and report that back
to the parent form in the form of enabled or disabled control Any
insight in this area would be greatly appreciated.

Regards,
Michael


If you're inserting a record via the subform, its AfterInsert event
should fire. It will not cause the parent's AfterInsert event to fire.
Nor will updating an existing record cause the AfterInsert to fire.
Also keep in mind that the subform loads prior to the parent so all of
its relevant form events (load, open, current, etc.) will fire prior to
the parent's events when the parent form is first opened.

Try setting a breakpoint in your AfterInsert code and step through it
to see where the problem lies.

Bruce

Jun 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tim Haughton | last post: by
3 posts views Thread by nobs | last post: by
3 posts views Thread by Lance | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.