473,389 Members | 1,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,389 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 1975
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tim Haughton | last post by:
I've just released an article on using Test Driven Development with C# and Windows Forms. GUI's are often difficult to test, so I thought it might be of interest. The article along with the...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
72
by: Paminu | last post by:
In math this expression: (a < b) && (b < c) would be described as: a < b < c But why is it that in C these two expressions evaluate to something different for the same values of a, b and...
3
by: nobs | last post by:
Hi guys I think I missunderstud something with delegates & events Hopefully someone can bring some light in this issue: Following problem I have a class which provide some events (like...
3
by: Lance | last post by:
I've noticed that controls that are contained in MDI child forms fail to raise MouseLeave events if the MDI child form's MdiParent property is set to Nothing (after it was set to an existing MDI...
7
by: Jeff | last post by:
I plan to write a Windows Forms MDI application for a medical office. Users must be able to select a patient and view related information on multiple forms; with1-4 forms opened at the same time...
4
by: Josh Soref | last post by:
It seems that windows file systems can have files dated to 1617, and unfortunately if you call _findfirst/_findnext on such a directory, msvcr80d will assert. Is there some provision for...
1
by: foothills bhc | last post by:
I have a problem with verifying content of controls on a form before closing the form or moving to the next form "record" (i.e., when moving to the next row of my form's record source). HERE'S THE...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.