Ok, here we go. I have an main form that pulls up general case info by case id (unique value) It has a subform that brings all accounts and acct info (from another tbl)related to each id.
Each case could have multiple accounts. Each account has a balance. On the main form, I need to be able to calculate the total case balance, the sum of the balances for all accounts related to that case. Following is the code I am currently using. Right now, I can only get it to calculate the dsum of the accounts related to the first record in the tbl. I think the problem is how to tell it to calculate all records from the account tbl that have the same case id as on the main form. Any ideas?
Private Sub Form_Open(Cancel As Integer)
Total balance.Value = DSum("[Account Info]![balance]", "Account Info", "[Account Info]![Case Id] = [Forms]![Edit Case Info]![Case ID]")
End Sub
Thanks in advance for any help!
Each case could have multiple accounts. Each account has a balance. On the main form, I need to be able to calculate the total case balance, the sum of the balances for all accounts related to that case. Following is the code I am currently using. Right now, I can only get it to calculate the dsum of the accounts related to the first record in the tbl. I think the problem is how to tell it to calculate all records from the account tbl that have the same case id as on the main form. Any ideas?
Private Sub Form_Open(Cancel As Integer)
Total balance.Value = DSum("[Account Info]![balance]", "Account Info", "[Account Info]![Case Id] = [Forms]![Edit Case Info]![Case ID]")
End Sub
Thanks in advance for any help!