Sep 21 2006, 11:16 AM
I have a form with a subform that displays all records associated with an invoice. The subform displays in continuous form. One of the fields asks user to enter a % that line represents as an allocation factor. In other words if there is one line the % is 100% if more than one the total of all must be 100%. That is where the DSUM comes in. I want to be able to test the entry before saving to be sure the entry totals 100%. I created an unbound text box and loaded this in the control source =DSum("[svp%]","[frmsvpdata]"). The text box displays #error also when entered this in the control field i got a popup message that says that "a property of the automation object requires or returns a data type not supported by VB"??
My thought was to do the dsum then run an if statement that checks to see if the sum is 100%, if not then i would pop up a message box.
Sep 21 2006, 11:20 AM
It appears you are using the forms name instead of the table to look for the data... Check DSum() in Access help for more details on this Function...
Sep 21 2006, 11:52 AM
Your right i was referencing the form. When i change it to the table though, it now sums all % for the entire table. I need to be able to set criteria to limit it to just the invoice that is diplayed in the subform.
Sep 21 2006, 11:56 AM
DSum("[FieldToSum]", "TableName", "Criteria")
will show you the correct way to set up your criteria. The examples are for the DLookup() function but the syntax is exactly the same...
Sep 21 2006, 12:04 PM
Thanks for your help. It now works!
Sep 21 2006, 12:06 PM
You are most welcome and I am glad to hear you got your code to work. Continued success with the project!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here