Budget Subforms

M

meghanwh

I have a project for a client that is essentially goals and subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget amounts,
it opens from the form which you enter the goals and takes the goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have the
opportunity to enter ine items for that goal.

So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items for
goal 1, and then has another box which has a sum of goals 1.1, 1.2,
1.1.1, etc.

Any hope? Thanks!
 
K

Ken Snell \(MVP\)

Put a textbox in the subform's Form Footer section. Set its Control Source
to
=Sum([NameOfFieldThatYouWantToSum])
 
M

meghanwh

Put a textbox in the subform's Form Footer section. Set its Control Source
to
=Sum([NameOfFieldThatYouWantToSum])

--

Ken Snell
<MS ACCESS MVP>




I have a project for a client that is essentially goals and subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget amounts,
it opens from the form which you enter the goals and takes the goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items for
goal 1, and then has another box which has a sum of goals 1.1, 1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -

- Show quoted text -

I do have a box on the subform that sums up the totals on the subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I just
don't knwo how to code that. Thanks.
 
K

Ken Snell \(MVP\)

Let's start with a clear picture of your form and subform design -- include
the SQL statements for the form's and subform's RecordSources. Tell us about
the actual data -- field names, table names, examples of data values.

If you're not including the "subsubgoal" data in the subform, then how are
those data associated to the subgoal data?
--

Ken Snell
<MS ACCESS MVP>




Put a textbox in the subform's Form Footer section. Set its Control
Source
to
=Sum([NameOfFieldThatYouWantToSum])

--

Ken Snell
<MS ACCESS MVP>




I have a project for a client that is essentially goals and subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget amounts,
it opens from the form which you enter the goals and takes the goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items for
goal 1, and then has another box which has a sum of goals 1.1, 1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -

- Show quoted text -

I do have a box on the subform that sums up the totals on the subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I just
don't knwo how to code that. Thanks.
 
M

meghanwh

Let's start with a clear picture of your form and subform design -- include
the SQL statements for the form's and subform's RecordSources. Tell us about
the actual data -- field names, table names, examples of data values.

If you're not including the "subsubgoal" data in the subform, then how are
those data associated to the subgoal data?
--

Ken Snell
<MS ACCESS MVP>


Put a textbox in the subform's Form Footer section. Set its Control
Source
to
=Sum([NameOfFieldThatYouWantToSum])
--
Ken Snell
<MS ACCESS MVP>

I have a project for a client that is essentially goals and subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget amounts,
it opens from the form which you enter the goals and takes the goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items for
goal 1, and then has another box which has a sum of goals 1.1, 1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -
- Show quoted text -
I do have a box on the subform that sums up the totals on the subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I just
don't knwo how to code that. Thanks.

Form: frmBudgetForm.
RecordSource: qryBudget
SELECT [GoalNumber], [GoalBudget]
From [tblMainGoals]
UNION
SELECT [Level2Number], [Level2Budget]
FROM [tblLevel2Goals];
UNION
SELECT [Level3Number], [Level3Budget]
FROM [tblLevel3Goals]
UNION
SELECT [Level4Number], [Level4Budget]
FROM [tblLevel4Goals]
UNION
SELECT [Level5Number], [Level5Budget]
FROM [tblLevel5Goals]
UNION SELECT [Level6Number], [Level6Budget]
FROM [tblLevel6Goals];

Subform was created within the form, called qryBudget subform
RecordSouce: SELECT tblBudget.BudgetLineID,
tblBudget.BudgetGoalNumber, tblBudget.Amount, tblBudget.BudgetCategory
FROM tblBudget;

On frmBudgetForm the only field is a text box TotalBudget=[qryBudget
subform].Form!TotalAmount
On qryBudget subform the fields are BudgetLineID (text box),
BudgetGoalNumber (Text box), Amount (text box) and Combo8 which is the
Budget categories: SELECT tblBudgetCategories.BudgetCategoryID,
tblBudgetCategories.BudgetCategory FROM tblBudgetCategories;
In the form footer I have a hidden control text box
TotalAmount=Sum([Amount])

Sample data might be:
ID: 1
Goal Number: 1
Amount: $100.00
Category: Travel

ID: 2
Goal Number: 1.1
Amount: $50.00
Category: Office Supplies

ID: 3
Goal Number: 1.1
Amount $25.00
Category: Travel

ID: 4
Goal Number: 1.1.1
Amount: $50.00
Category: Misc

The goals go down 6 levels to 1.2.3.4.5.6, and I need to know a total
amount of all the subgoals for any particular goal. So for instance,
if I open the form to goal 1.1, I need to have it add the specific
line items that apply to 1.1, but also the line items that apply to
1.1.2, 1.1.2.3, etc., essentially to GoalNumber*.

Should I change the record source of frmBudgetForm to tblBudget? I
think one of the problems I have is I don't know how to relate the
subsubform data to the subform or to the actual form. It doesn't seem
like a direct relationship to me, and it seems like one that would
have to be created artificially.

Thanks so much.
 
K

Ken Snell \(MVP\)

If I'm understanding your setup correctly, I think you can get your desired
result if you put another textbox in the Detail section of the subform (name
the textbox txtSubGoalTotal), and set its RecordSource to this expression:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like " & [BudgetGoalNumber]
& "*")


--

Ken Snell
<MS ACCESS MVP>




Let's start with a clear picture of your form and subform design --
include
the SQL statements for the form's and subform's RecordSources. Tell us
about
the actual data -- field names, table names, examples of data values.

If you're not including the "subsubgoal" data in the subform, then how
are
those data associated to the subgoal data?
--

Ken Snell
<MS ACCESS MVP>


On Oct 13, 11:22 am, "Ken Snell \(MVP\)"
Put a textbox in the subform's Form Footer section. Set its Control
Source
to
=Sum([NameOfFieldThatYouWantToSum])

Ken Snell
<MS ACCESS MVP>
I have a project for a client that is essentially goals and subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a
table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget amounts,
it opens from the form which you enter the goals and takes the goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items
for
goal 1, and then has another box which has a sum of goals 1.1, 1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -
- Show quoted text -
I do have a box on the subform that sums up the totals on the subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I just
don't knwo how to code that. Thanks.

Form: frmBudgetForm.
RecordSource: qryBudget
SELECT [GoalNumber], [GoalBudget]
From [tblMainGoals]
UNION
SELECT [Level2Number], [Level2Budget]
FROM [tblLevel2Goals];
UNION
SELECT [Level3Number], [Level3Budget]
FROM [tblLevel3Goals]
UNION
SELECT [Level4Number], [Level4Budget]
FROM [tblLevel4Goals]
UNION
SELECT [Level5Number], [Level5Budget]
FROM [tblLevel5Goals]
UNION SELECT [Level6Number], [Level6Budget]
FROM [tblLevel6Goals];

Subform was created within the form, called qryBudget subform
RecordSouce: SELECT tblBudget.BudgetLineID,
tblBudget.BudgetGoalNumber, tblBudget.Amount, tblBudget.BudgetCategory
FROM tblBudget;

On frmBudgetForm the only field is a text box TotalBudget=[qryBudget
subform].Form!TotalAmount
On qryBudget subform the fields are BudgetLineID (text box),
BudgetGoalNumber (Text box), Amount (text box) and Combo8 which is the
Budget categories: SELECT tblBudgetCategories.BudgetCategoryID,
tblBudgetCategories.BudgetCategory FROM tblBudgetCategories;
In the form footer I have a hidden control text box
TotalAmount=Sum([Amount])

Sample data might be:
ID: 1
Goal Number: 1
Amount: $100.00
Category: Travel

ID: 2
Goal Number: 1.1
Amount: $50.00
Category: Office Supplies

ID: 3
Goal Number: 1.1
Amount $25.00
Category: Travel

ID: 4
Goal Number: 1.1.1
Amount: $50.00
Category: Misc

The goals go down 6 levels to 1.2.3.4.5.6, and I need to know a total
amount of all the subgoals for any particular goal. So for instance,
if I open the form to goal 1.1, I need to have it add the specific
line items that apply to 1.1, but also the line items that apply to
1.1.2, 1.1.2.3, etc., essentially to GoalNumber*.

Should I change the record source of frmBudgetForm to tblBudget? I
think one of the problems I have is I don't know how to relate the
subsubform data to the subform or to the actual form. It doesn't seem
like a direct relationship to me, and it seems like one that would
have to be created artificially.

Thanks so much.
 
M

meghanwh

If I'm understanding your setup correctly, I think you can get your desired
result if you put another textbox in the Detail section of the subform (name
the textbox txtSubGoalTotal), and set its RecordSource to this expression:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like " & [BudgetGoalNumber]
& "*")

--

Ken Snell
<MS ACCESS MVP>


Let's start with a clear picture of your form and subform design --
include
the SQL statements for the form's and subform's RecordSources. Tell us
about
the actual data -- field names, table names, examples of data values.
If you're not including the "subsubgoal" data in the subform, then how
are
those data associated to the subgoal data?
--
Ken Snell
<MS ACCESS MVP>

On Oct 13, 11:22 am, "Ken Snell \(MVP\)"
Put a textbox in the subform's Form Footer section. Set its Control
Source
to
=Sum([NameOfFieldThatYouWantToSum])
--
Ken Snell
<MS ACCESS MVP>

I have a project for a client that is essentially goals and subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a
table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget amounts,
it opens from the form which you enter the goals and takes the goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items
for
goal 1, and then has another box which has a sum of goals 1.1, 1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -
- Show quoted text -
I do have a box on the subform that sums up the totals on the subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I just
don't knwo how to code that. Thanks.
Form: frmBudgetForm.
RecordSource: qryBudget
SELECT [GoalNumber], [GoalBudget]
From [tblMainGoals]
UNION
SELECT [Level2Number], [Level2Budget]
FROM [tblLevel2Goals];
UNION
SELECT [Level3Number], [Level3Budget]
FROM [tblLevel3Goals]
UNION
SELECT [Level4Number], [Level4Budget]
FROM [tblLevel4Goals]
UNION
SELECT [Level5Number], [Level5Budget]
FROM [tblLevel5Goals]
UNION SELECT [Level6Number], [Level6Budget]
FROM [tblLevel6Goals];
Subform was created within the form, called qryBudget subform
RecordSouce: SELECT tblBudget.BudgetLineID,
tblBudget.BudgetGoalNumber, tblBudget.Amount, tblBudget.BudgetCategory
FROM tblBudget;
On frmBudgetForm the only field is a text box TotalBudget=[qryBudget
subform].Form!TotalAmount
On qryBudget subform the fields are BudgetLineID (text box),
BudgetGoalNumber (Text box), Amount (text box) and Combo8 which is the
Budget categories: SELECT tblBudgetCategories.BudgetCategoryID,
tblBudgetCategories.BudgetCategory FROM tblBudgetCategories;
In the form footer I have a hidden control text box
TotalAmount=Sum([Amount])
Sample data might be:
ID: 1
Goal Number: 1
Amount: $100.00
Category: Travel
ID: 2
Goal Number: 1.1
Amount: $50.00
Category: Office Supplies
ID: 3
Goal Number: 1.1
Amount $25.00
Category: Travel
ID: 4
Goal Number: 1.1.1
Amount: $50.00
Category: Misc
The goals go down 6 levels to 1.2.3.4.5.6, and I need to know a total
amount of all the subgoals for any particular goal. So for instance,
if I open the form to goal 1.1, I need to have it add the specific
line items that apply to 1.1, but also the line items that apply to
1.1.2, 1.1.2.3, etc., essentially to GoalNumber*.
Should I change the record source of frmBudgetForm to tblBudget? I
think one of the problems I have is I don't know how to relate the
subsubform data to the subform or to the actual form. It doesn't seem
like a direct relationship to me, and it seems like one that would
have to be created artificially.
Thanks so much.

I tried that and am only getting #Error in the new text box. The
subform is in datasheet view, does this have anything to do with it?
 
K

Ken Snell \(MVP\)

My error:

=DSum("Amount", "tblBudgetCategories", "[BudgetGoalNumber] Like " &
[BudgetGoalNumber] & "*")

--

Ken Snell
<MS ACCESS MVP>


If I'm understanding your setup correctly, I think you can get your
desired
result if you put another textbox in the Detail section of the subform
(name
the textbox txtSubGoalTotal), and set its RecordSource to this
expression:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like " &
[BudgetGoalNumber]
& "*")

--

Ken Snell
<MS ACCESS MVP>


On Oct 13, 12:25 pm, "Ken Snell \(MVP\)"
Let's start with a clear picture of your form and subform design --
include
the SQL statements for the form's and subform's RecordSources. Tell us
about
the actual data -- field names, table names, examples of data values.
If you're not including the "subsubgoal" data in the subform, then how
are
those data associated to the subgoal data?
--
Ken Snell
<MS ACCESS MVP>

On Oct 13, 11:22 am, "Ken Snell \(MVP\)"
Put a textbox in the subform's Form Footer section. Set its Control
Source
to
=Sum([NameOfFieldThatYouWantToSum])

Ken Snell
<MS ACCESS MVP>
I have a project for a client that is essentially goals and
subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a
table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget
amounts,
it opens from the form which you enter the goals and takes the
goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have
the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items
for
goal 1, and then has another box which has a sum of goals 1.1,
1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -
- Show quoted text -
I do have a box on the subform that sums up the totals on the
subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I
just
don't knwo how to code that. Thanks.
Form: frmBudgetForm.
RecordSource: qryBudget
SELECT [GoalNumber], [GoalBudget]
From [tblMainGoals]
UNION
SELECT [Level2Number], [Level2Budget]
FROM [tblLevel2Goals];
UNION
SELECT [Level3Number], [Level3Budget]
FROM [tblLevel3Goals]
UNION
SELECT [Level4Number], [Level4Budget]
FROM [tblLevel4Goals]
UNION
SELECT [Level5Number], [Level5Budget]
FROM [tblLevel5Goals]
UNION SELECT [Level6Number], [Level6Budget]
FROM [tblLevel6Goals];
Subform was created within the form, called qryBudget subform
RecordSouce: SELECT tblBudget.BudgetLineID,
tblBudget.BudgetGoalNumber, tblBudget.Amount, tblBudget.BudgetCategory
FROM tblBudget;
On frmBudgetForm the only field is a text box TotalBudget=[qryBudget
subform].Form!TotalAmount
On qryBudget subform the fields are BudgetLineID (text box),
BudgetGoalNumber (Text box), Amount (text box) and Combo8 which is the
Budget categories: SELECT tblBudgetCategories.BudgetCategoryID,
tblBudgetCategories.BudgetCategory FROM tblBudgetCategories;
In the form footer I have a hidden control text box
TotalAmount=Sum([Amount])
Sample data might be:
ID: 1
Goal Number: 1
Amount: $100.00
Category: Travel
ID: 2
Goal Number: 1.1
Amount: $50.00
Category: Office Supplies
ID: 3
Goal Number: 1.1
Amount $25.00
Category: Travel
ID: 4
Goal Number: 1.1.1
Amount: $50.00
Category: Misc
The goals go down 6 levels to 1.2.3.4.5.6, and I need to know a total
amount of all the subgoals for any particular goal. So for instance,
if I open the form to goal 1.1, I need to have it add the specific
line items that apply to 1.1, but also the line items that apply to
1.1.2, 1.1.2.3, etc., essentially to GoalNumber*.
Should I change the record source of frmBudgetForm to tblBudget? I
think one of the problems I have is I don't know how to relate the
subsubform data to the subform or to the actual form. It doesn't seem
like a direct relationship to me, and it seems like one that would
have to be created artificially.
Thanks so much.

I tried that and am only getting #Error in the new text box. The
subform is in datasheet view, does this have anything to do with it?
 
M

meghanwh

My error:

=DSum("Amount", "tblBudgetCategories", "[BudgetGoalNumber] Like " &
[BudgetGoalNumber] & "*")

--

Ken Snell
<MS ACCESS MVP>


If I'm understanding your setup correctly, I think you can get your
desired
result if you put another textbox in the Detail section of the subform
(name
the textbox txtSubGoalTotal), and set its RecordSource to this
expression:
=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like " &
[BudgetGoalNumber]
& "*")
--
Ken Snell
<MS ACCESS MVP>

On Oct 13, 12:25 pm, "Ken Snell \(MVP\)"
Let's start with a clear picture of your form and subform design --
include
the SQL statements for the form's and subform's RecordSources. Tell us
about
the actual data -- field names, table names, examples of data values.
If you're not including the "subsubgoal" data in the subform, then how
are
those data associated to the subgoal data?
--
Ken Snell
<MS ACCESS MVP>

On Oct 13, 11:22 am, "Ken Snell \(MVP\)"
Put a textbox in the subform's Form Footer section. Set its Control
Source
to
=Sum([NameOfFieldThatYouWantToSum])
--
Ken Snell
<MS ACCESS MVP>

I have a project for a client that is essentially goals and
subgoals,
so for instance, you have goal 1 and subgoal 1.1. I've created a
table
tblBudget with fields BudgetLineID, BudgetGoalNumber, Amount and
BudgetCategory (which comes from a separate categories table). I
created a form with a subform to enter the different budget
amounts,
it opens from the form which you enter the goals and takes the
goal
number as a filter for the budget form. The client would like the
budget to display the sum of all the subgoals, as well as have
the
opportunity to enter ine items for that goal.
So for instance, if I open the budget form for goal 1, it has the
subform which I've already created which shows you the line items
for
goal 1, and then has another box which has a sum of goals 1.1,
1.2,
1.1.1, etc.
Any hope? Thanks!- Hide quoted text -
- Show quoted text -
I do have a box on the subform that sums up the totals on the
subform,
but the part i'm having trouble with is getting the other subgoals.
For instance, the subform has line items for goal 1.1, and I need to
have the total of goals 1.1.1, 1.1.2, 1.1.1.1, etc., and those goals
are not on the subform. It's essentially the sum of goal 1.1*, I
just
don't knwo how to code that. Thanks.
Form: frmBudgetForm.
RecordSource: qryBudget
SELECT [GoalNumber], [GoalBudget]
From [tblMainGoals]
UNION
SELECT [Level2Number], [Level2Budget]
FROM [tblLevel2Goals];
UNION
SELECT [Level3Number], [Level3Budget]
FROM [tblLevel3Goals]
UNION
SELECT [Level4Number], [Level4Budget]
FROM [tblLevel4Goals]
UNION
SELECT [Level5Number], [Level5Budget]
FROM [tblLevel5Goals]
UNION SELECT [Level6Number], [Level6Budget]
FROM [tblLevel6Goals];
Subform was created within the form, called qryBudget subform
RecordSouce: SELECT tblBudget.BudgetLineID,
tblBudget.BudgetGoalNumber, tblBudget.Amount, tblBudget.BudgetCategory
FROM tblBudget;
On frmBudgetForm the only field is a text box TotalBudget=[qryBudget
subform].Form!TotalAmount
On qryBudget subform the fields are BudgetLineID (text box),
BudgetGoalNumber (Text box), Amount (text box) and Combo8 which is the
Budget categories: SELECT tblBudgetCategories.BudgetCategoryID,
tblBudgetCategories.BudgetCategory FROM tblBudgetCategories;
In the form footer I have a hidden control text box
TotalAmount=Sum([Amount])
Sample data might be:
ID: 1
Goal Number: 1
Amount: $100.00
Category: Travel
ID: 2
Goal Number: 1.1
Amount: $50.00
Category: Office Supplies
ID: 3
Goal Number: 1.1
Amount $25.00
Category: Travel
ID: 4
Goal Number: 1.1.1
Amount: $50.00
Category: Misc
The goals go down 6 levels to 1.2.3.4.5.6, and I need to know a total
amount of all the subgoals for any particular goal. So for instance,
if I open the form to goal 1.1, I need to have it add the specific
line items that apply to 1.1, but also the line items that apply to
1.1.2, 1.1.2.3, etc., essentially to GoalNumber*.
Should I change the record source of frmBudgetForm to tblBudget? I
think one of the problems I have is I don't know how to relate the
subsubform data to the subform or to the actual form. It doesn't seem
like a direct relationship to me, and it seems like one that would
have to be created artificially.
Thanks so much.
I tried that and am only getting #Error in the new text box. The
subform is in datasheet view, does this have anything to do with it?

I'm still getting the error. Could this have anything to do with the
fact that the subform and the form have different recordsources?
 
K

Ken Snell \(MVP\)

OK - I've reread your post, and let's try this:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like '" &
[BudgetGoalNumber] & "*'")
 
M

meghanwh

OK - I've reread your post, and let's try this:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like '" &
[BudgetGoalNumber] & "*'")

--

Ken Snell
<MS ACCESS MVP>


I'm still getting the error. Could this have anything to do with the
fact that the subform and the form have different recordsources?

Oh that's fantastic. So that total is not saved anywhere, right? I'm
wondering if it's possible to get that total amount listed on a
different form.
 
K

Ken Snell \(MVP\)

OK - I've reread your post, and let's try this:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like '" &
[BudgetGoalNumber] & "*'")

--

Ken Snell
<MS ACCESS MVP>


I tried that and am only getting #Error in the new text box. The
subform is in datasheet view, does this have anything to do with it?
I'm still getting the error. Could this have anything to do with the
fact that the subform and the form have different recordsources?

Oh that's fantastic. So that total is not saved anywhere, right? I'm
wondering if it's possible to get that total amount listed on a
different form.

You'll need to provide more details about "different form" in terms of what
the form is, is it open while your current form is open, etc. But is there a
reason why you can't just calculate that sum whenever you want to show it?
 
M

meghanwh

OK - I've reread your post, and let's try this:
=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like '" &
[BudgetGoalNumber] & "*'")
--
Ken Snell
<MS ACCESS MVP>

I tried that and am only getting #Error in the new text box. The
subform is in datasheet view, does this have anything to do with it?
I'm still getting the error. Could this have anything to do with the
fact that the subform and the form have different recordsources?
Oh that's fantastic. So that total is not saved anywhere, right? I'm
wondering if it's possible to get that total amount listed on a
different form.

You'll need to provide more details about "different form" in terms of what
the form is, is it open while your current form is open, etc. But is there a
reason why you can't just calculate that sum whenever you want to show it?

There's a group of forms, frmMainGoals, fmrLevel2Goals,
frmLevel3Goals, etc. On those forms there is a button which opens
frmBudgetForm. There's no reason why the budget total can't be
calculated each time you open frmBudgetForm, but the client would like
to see the total on frmMainGoals (etc.). If it's not possible then
that's fine too, I can explain to him that it's not possible.
 
K

Ken Snell \(MVP\)

There's a group of forms, frmMainGoals, fmrLevel2Goals,
frmLevel3Goals, etc. On those forms there is a button which opens
frmBudgetForm. There's no reason why the budget total can't be
calculated each time you open frmBudgetForm, but the client would like
to see the total on frmMainGoals (etc.). If it's not possible then
that's fine too, I can explain to him that it's not possible.

I don't have a good mental picture of all these forms' layout/content, so I
cannot give you a firm answer. However, it's likely that you could put a
textbox on the frmMainGoals form that would do someething similar, using
similar expression except that you probably need to change the last field
name to the one that is on frmMainGoals:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like '" &
[YouNeedToPutCorrectFieldNameHere] & "*'")
 
M

meghanwh

There's a group of forms, frmMainGoals, fmrLevel2Goals,
frmLevel3Goals, etc. On those forms there is a button which opens
frmBudgetForm. There's no reason why the budget total can't be
calculated each time you open frmBudgetForm, but the client would like
to see the total on frmMainGoals (etc.). If it's not possible then
that's fine too, I can explain to him that it's not possible.

I don't have a good mental picture of all these forms' layout/content, so I
cannot give you a firm answer. However, it's likely that you could put a
textbox on the frmMainGoals form that would do someething similar, using
similar expression except that you probably need to change the last field
name to the one that is on frmMainGoals:

=DSum("Amount", "tblBudget", "[BudgetGoalNumber] Like '" &
[YouNeedToPutCorrectFieldNameHere] & "*'")

Thanks so much. One more quick question. I have a field on a report,
it's a text box:
="Budget: " & (DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"))

Is there any way to get the numerical part formatted as currency?
Thanks!
 
K

Ken Snell \(MVP\)

Thanks so much. One more quick question. I have a field on a report,
it's a text box:
="Budget: " & (DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"))

Is there any way to get the numerical part formatted as currency?
Thanks!

="Budget: " & Format(DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"), "Currency")
 
M

meghanwh

Thanks so much. One more quick question. I have a field on a report,
it's a text box:
="Budget: " & (DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"))
Is there any way to get the numerical part formatted as currency?
Thanks!

="Budget: " & Format(DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"), "Currency")

Thanks Ken. Now, I copied the frmBudgetForm for a payments form
frmPaymentForm. frmPaymentForm is based on qryPayments:

SELECT tblPayments.PaymentID, tblPayments.PaymentGoalNumber,
tblPayments.Amount, tblPayments.BudgetCategory, tblPayments.Vendor,
tblPayments.Date, tblPayments.[Vendor's Invoice]
FROM tblPayments;

When I click on the payments form button on each form, it only
inserts the proper goal number IF there's already a payment for that
specific Payment Goal Number. I'm a bit puzzled because this works
perfectly on the frmBudgetForm, regardless of if there's a previous
budget item or not. Isn't there a way to get it to put the correct
Payment Goal Number in the subform on frmPaymentForm no matter if
there's a previous payment or not? Thanks.
 
M

meghanwh

Thanks so much. One more quick question. I have a field on a report,
it's a text box:
="Budget: " & (DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"))
Is there any way to get the numerical part formatted as currency?
Thanks!

="Budget: " & Format(DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"), "Currency")

One question on the DSum. If there's nothing entered for a particular
GoalNumber, it returns the sum of all the BudgetGoalNumbers instead of
just saying Null or zero. Is there any way to fix this? Thanks!
 
K

Ken Snell \(MVP\)

I'm sorry, but I am not understanding your setup here. Can you explain more
details about what you're doing with this new form, how you navigate to it
(code that you're using to open it, for example), etc.? We were discussing
how to show subtotals of goals and subgoals, and now we appear to be
discussing how to edit the data?
 
K

Ken Snell \(MVP\)

Sure:

="Budget: " & IIf(Len([GoalNumber] & "")>0,
Format(DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"), "Currency")," no goal number entered")

--

Ken Snell
<MS ACCESS MVP>


Thanks so much. One more quick question. I have a field on a report,
it's a text box:
="Budget: " & (DSum("Amount","tblBudget","[BudgetGoalNumber] Like '" &
[GoalNumber] & "*'"))
Is there any way to get the numerical part formatted as currency?
Thanks!

="Budget: " & Format(DSum("Amount","tblBudget","[BudgetGoalNumber] Like
'" &
[GoalNumber] & "*'"), "Currency")

One question on the DSum. If there's nothing entered for a particular
GoalNumber, it returns the sum of all the BudgetGoalNumbers instead of
just saying Null or zero. Is there any way to fix this? Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top