Null value after cleaning table

Gilfdz

Registered User.
Local time
Tomorrow, 00:48
Joined
Sep 18, 2007
Messages
36
Hello i have 7 tables, 7 forms and one query calculating a total for each table. Everything works perfect but every time i delete all the records from the tables ("clean") if i run the query it returns NOTHING....NULL, empty fields, NOT even "0", which is what im expecting. Its only AFTER opening and closing the form of the "cleaned" table, that the query returns the proper "0". The easiest solution i could find was to open/close each of the forms AFTER i hit the button which deletes all the records of all the tables.

Is there any other way to "initialize" the tables so that i dont have to open/close the forms??? if not? how can i improve my current code??? Right now i CAN see that the forms are opening and closing, which i need to HIDE.

Code:
DoCmd.OpenForm "pricingl1v1", , , , , , acHidden
Forms!PricingL1V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl1v1"
DoCmd.OpenForm "pricingl2v1", , , , , , acHidden
Forms!PricingL2V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl2v1"
DoCmd.OpenForm "pricingl3v1", , , , , , acHidden
Forms!PricingL3V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl3v1"
DoCmd.OpenForm "pricingl4v1", , , , , , acHidden
Forms!PricingL4V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl4v1"
DoCmd.OpenForm "pricingl5v1", , , , , , acHidden
Forms!PricingL5V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl5v1"
DoCmd.OpenForm "pricingl6v1", , , , , , acHidden
Forms!PricingL6V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl6v1"
DoCmd.OpenForm "pricingl7v1", , , , , , acHidden
Forms!PricingL7V1!PrixTotalddpew = 0
DoCmd.Close acForm, "pricingl7v1"

Thanks
 
When you are summing the values in your query (this would be easier if you and also included the SQL from one of your queries), use the Nz() function to return a zero if a null is found. Lookup Nz in Access help for more info.
In the query Field row, use PrixTotalddpew: Nz([PrixTotalddpew] if this is the field being Summed.
 

Users who are viewing this thread

Back
Top Bottom