G
tina said:if you want to show the "running" balance on each record, and assuming that
you have a Date/Time field that gives you a chronological order for the
records in the table: you can use an expression in an unbound control on
the form to sum the balance for every record * equal and prior to* the
current record. something along the lines of
=DSum("[ValueField]", "TableName", "[DateField] <= #" & [DateField] & "#")
substitute the correct table and field names, of course.
hth
Cory said:This helps but I am not quite there yet. I have a table with transactions to
various account numbers. I have a form that shows account number and some
account infromation, then a subform which displays transactions to that
account. When I create the field and enter the expression like you show
below, I get the running balance of ALL transactions before that date, not
just the ones for that account. What have I done wrong?? Thanks for your
help.
tina said:if you want to show the "running" balance on each record, and assuming that
you have a Date/Time field that gives you a chronological order for the
records in the table: you can use an expression in an unbound control on
the form to sum the balance for every record * equal and prior to* the
current record. something along the lines of
=DSum("[ValueField]", "TableName", "[DateField] <= #" & [DateField] & "#")
substitute the correct table and field names, of course.
hth
tina said:nothing wrong. we just need to include criteria to specify the account.
presumably there is a field in the transactions table which links to the
accounts table, and identifies each account. i'll just call that field
AccountID. change the expression to
=DSum("[ValueField]", "TableName", "[AccountID] = " & [AccountID] & " And
[DateField] <= #" & [DateField] & "#")
if the account ID field is Text data type, rather than Number data type,
then the syntax would be
=DSum("[ValueField]", "TableName", "[AccountID] = '" & [AccountID] & "' And
[DateField] <= #" & [DateField] & "#")
again, you need to substitute the correct name of the account ID field.
hth
Cory said:This helps but I am not quite there yet. I have a table with transactions to
various account numbers. I have a form that shows account number and some
account infromation, then a subform which displays transactions to that
account. When I create the field and enter the expression like you show
below, I get the running balance of ALL transactions before that date, not
just the ones for that account. What have I done wrong?? Thanks for your
help.
tina said:if you want to show the "running" balance on each record, and assuming that
you have a Date/Time field that gives you a chronological order for the
records in the table: you can use an expression in an unbound control on
the form to sum the balance for every record * equal and prior to* the
current record. something along the lines of
=DSum("[ValueField]", "TableName", "[DateField] <= #" & [DateField] & "#")
substitute the correct table and field names, of course.
hth
Cory said:Works like a charm....thanks for all of your help.
tina said:nothing wrong. we just need to include criteria to specify the account.
presumably there is a field in the transactions table which links to the
accounts table, and identifies each account. i'll just call that field
AccountID. change the expression to
=DSum("[ValueField]", "TableName", "[AccountID] = " & [AccountID] & " And
[DateField] <= #" & [DateField] & "#")
if the account ID field is Text data type, rather than Number data type,
then the syntax would be
=DSum("[ValueField]", "TableName", "[AccountID] = '" & [AccountID] & "' And
[DateField] <= #" & [DateField] & "#")
again, you need to substitute the correct name of the account ID field.
hth
transactionsCory said:This helps but I am not quite there yet. I have a table with
toassumingvarious account numbers. I have a form that shows account number and some
account infromation, then a subform which displays transactions to that
account. When I create the field and enter the expression like you show
below, I get the running balance of ALL transactions before that date, not
just the ones for that account. What have I done wrong?? Thanks for your
help.
:
if you want to show the "running" balance on each record, and
thatcontrolyou have a Date/Time field that gives you a chronological order for the
records in the table: you can use an expression in an unbound
on&the form to sum the balance for every record * equal and prior to* the
current record. something along the lines of
=DSum("[ValueField]", "TableName", "[DateField] <= #" & [DateField]
"#")substitute the correct table and field names, of course.
hth
tina said:nothing wrong. we just need to include criteria to specify the account.
presumably there is a field in the transactions table which links to the
accounts table, and identifies each account. i'll just call that field
AccountID. change the expression to
=DSum("[ValueField]", "TableName", "[AccountID] = " & [AccountID] & " And
[DateField] <= #" & [DateField] & "#")
if the account ID field is Text data type, rather than Number data type,
then the syntax would be
=DSum("[ValueField]", "TableName", "[AccountID] = '" & [AccountID] & "' And
[DateField] <= #" & [DateField] & "#")
again, you need to substitute the correct name of the account ID field.
hth
Cory said:This helps but I am not quite there yet. I have a table with transactions to
various account numbers. I have a form that shows account number and some
account infromation, then a subform which displays transactions to that
account. When I create the field and enter the expression like you show
below, I get the running balance of ALL transactions before that date, not
just the ones for that account. What have I done wrong?? Thanks for your
help.
tina said:if you want to show the "running" balance on each record, and assuming that
you have a Date/Time field that gives you a chronological order for the
records in the table: you can use an expression in an unbound control on
the form to sum the balance for every record * equal and prior to* the
current record. something along the lines of
=DSum("[ValueField]", "TableName", "[DateField] <= #" & [DateField] & "#")
substitute the correct table and field names, of course.
hth