Can someone please explain basic query logic to me?

vangogh228

Registered User.
Local time
Today, 18:12
Joined
Apr 19, 2002
Messages
302
I am not sure if I understand this...

I have MainTable, on which I base MainForm. I would like to have MainForm show only the records that have a null value in CertainField. If I write NullQuery to select only those records, can I redirect MainForm to NullQuery? Well, I know I can do that... but how does MainTable get updated with new records if MainForm is based on NullQuery????

Any help is greatly appreciated.

Tom
 
Because NullQuery is based on MainTable.
 
This is my take on how this would work under Access:

1. You open a form based on NullQuery.

2. Access runs NullQuery to generate a list (recordset) of records that match your selection query. You never actually see this recordset, but Access holds onto it as long as the form is open.

3. The form positions itself to the first record of the recordset (if the set isn't empty).

4. You can do whatever you please (or at least whatever the form allows) to any record in the recordset - until certain things happen, see #7 below.

5. Navigation buttons just traverse forward or backwards through the recordset opened in step 2.

6. You will always be able to visit records as noted in 5 EVEN IF YOU UPDATED THE NULL FIELD for some of them. Until #7 kicks in, see below.

7. The moment your code behind the does a ReQuery, or if you perform a ReQuery from a menu-bar option, you regenerate a new recordset (see #2 above.) Or, if you close the form and open it again, you re-run the query. At that point, if you had updated a record to no longer be null in the critical field, the ReQuery will no longer return that record.

Does this help?
 
Yes, it does. Thank you. I guess one thing I need to be sure of is that NullQuery includes all the fields of MainTable.

Thanks, guys.
 
vangogh228 said:
Yes, it does. Thank you. I guess one thing I need to be sure of is that NullQuery includes all the fields of MainTable.
Only if you need all of the fields in the form. The fields that exist in the form can be edited, but any that are not there are simply unchanged.
 

Users who are viewing this thread

Back
Top Bottom