Babycat
Member
- Local time
 - Today, 16:07
 
- Joined
 - Mar 31, 2020
 
- Messages
 - 291
 
Hello everyone,
I have the main and subform that both use same table TBLPRODUCT.
The subform is a continous form so that list out all products name while mainform show the product detail which is currently selected on subform.
If the table TBLPRODUCT is empty, somehow the subform (and other bounded controls) on mainform will not display.
In that case, if I try to requery subform then it introduces an run-time error likely the object is not existing.... So I normally have to check
	
	
	
		
But I dont feel it efficent, because most of time the table product is not empty. Moreover, if it contains 1,000,000 rows, Dcount might require a amount of time, Am I right? I also know I can simply Resume Next if error occured but I am kind of hating error
.
So my questions are:
1. Should I do the check as above code before requery?
2. Or I should use Resume Next?
3. The statement If DCount("ProductID", "TBLPRODUCT") > 0, does Dcount smart enough to stop as soon as it reached 1 or is still have to count until 1,000,000?
Sorry for weird questions.
 I have the main and subform that both use same table TBLPRODUCT.
The subform is a continous form so that list out all products name while mainform show the product detail which is currently selected on subform.
If the table TBLPRODUCT is empty, somehow the subform (and other bounded controls) on mainform will not display.
In that case, if I try to requery subform then it introduces an run-time error likely the object is not existing.... So I normally have to check
		Code:
	
	
	        If DCount("ProductID", "TBLPRODUCT") > 0 Then         
                Forms!MainFrm.Form.Requery
                Forms!MainFrm.Form!SubFrmTable.Form.Requery
        End If
	But I dont feel it efficent, because most of time the table product is not empty. Moreover, if it contains 1,000,000 rows, Dcount might require a amount of time, Am I right? I also know I can simply Resume Next if error occured but I am kind of hating error
So my questions are:
1. Should I do the check as above code before requery?
2. Or I should use Resume Next?
3. The statement If DCount("ProductID", "TBLPRODUCT") > 0, does Dcount smart enough to stop as soon as it reached 1 or is still have to count until 1,000,000?
Sorry for weird questions.