View Full Version : finding multiple fields that might contain nulls


russi
11-01-2001, 09:45 AM
Okay, here's the scoop.

In a table upon which forms are based, there are fields that need to have values, EVENTUALLY. The problem with making them mandatory to do at time of saving a given form,, is that there is frequently times when a data entry person has some missing or unintelligible info and only notices it when already having entered much of the form.

How do I 'easily' do a query based on the 1 table asking it to identify who is missing info in ANY of say a dozen fields?

Thanks.

Russ

Pat Hartman
11-01-2001, 01:00 PM
When I have this situation, I add a flag column to the table with Yes/No values indicating Complete/Incomplete. This allows a simple check in all my other queries so that I can bypass incomplete records when reporting or run a query to pull out all the incomplete records and remind people to finish them or delete them. Having the one field flag also helps prevent lots of changes if the list of required fields changes. You would only have to change the BeforeUpdate event of the form. All your other processes would be just fine.

To do this,
1) add the new column with a default of "No".
2) add code to the BeforeUpdate event of the update form to check all fields that will ultimately require data. If they are all populated, set the CompleteFlag to "Yes", otherwise set it to "No".
3) to clean up what you have, run an update query to set all the rows to "No". Then you'll need an update query that looks for any row that has Complete data and sets the CompleteFlag to "Yes". To build this query, open the QBE grid, add all the columns you want to check plus the CompleteFlag. Then on the first critera line put - Not Is Null under each field except the CompleteFlag. Then change the query to an update query and place - "-1" (withoug the quotes) in the update to field of the CompleteFlag.

russi
11-02-2001, 05:54 AM
Thank you, Pat!

As always, you are a wonder.
You and yours should be proud.

Russ