"#Name?" appearing in place of data from subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I hope you can help me. I have a simple database with 2 tables. (the
database is used to store lesson plans) I have created a form with fields
from table1 with a subform containing fields from table2 (displayed as a
continuous form), all works OK. I have a field in table2 called "time", I
have created a query called "time total", to calculate the sum based on the
curent record from table1, and when ran, displays the desired result.
I created a text box, and using the expression builder, entered the following:
= [Time total]![SumOfTime] Which is the result of the query.
When the form is displayed, the box displays "#Name?"
I have checked out "help" to no avail..Please help
Thanks
Dave
 
If the query resault has only one record, then use DLookUp to retrieve the
value from the query

=DLookUp("[SumOfTime]","[Time total]")
 
Thanks for the quick reply Ofer.
The query groups by "table1", and then Sums the "time" field in "table2",
therefore the result contains all the records from "table1", and the summed
"time" field from "table2". The solution you provided gave me a result, but
it was the total for all records, not just the one in focus on the parent
form.
I've taken some screenshots to clarify..

http://www.davestubbs1.f2s.com/Pics/Formwithsubform.jpg
http://www.davestubbs1.f2s.com/Pics/query.jpg
http://www.davestubbs1.f2s.com/Pics/queryresults.jpg

Once again, thanks
Dave


Ofer said:
If the query resault has only one record, then use DLookUp to retrieve the
value from the query

=DLookUp("[SumOfTime]","[Time total]")

--
\\// Live Long and Prosper \\//
BS"D


Anode123 said:
Hi,
I hope you can help me. I have a simple database with 2 tables. (the
database is used to store lesson plans) I have created a form with fields
from table1 with a subform containing fields from table2 (displayed as a
continuous form), all works OK. I have a field in table2 called "time", I
have created a query called "time total", to calculate the sum based on the
curent record from table1, and when ran, displays the desired result.
I created a text box, and using the expression builder, entered the following:
= [Time total]![SumOfTime] Which is the result of the query.
When the form is displayed, the box displays "#Name?"
I have checked out "help" to no avail..Please help
Thanks
Dave
 
In that case
Create a text field in the SubForm form footer, not visible, and in the
control source of this field write

=Sum([Time FieldName])

On the Main form text box write
=[Sub Form control name].Form![Text box name created as specified above]


--
HTH, Good Luck
BS"D


Anode123 said:
Thanks for the quick reply Ofer.
The query groups by "table1", and then Sums the "time" field in "table2",
therefore the result contains all the records from "table1", and the summed
"time" field from "table2". The solution you provided gave me a result, but
it was the total for all records, not just the one in focus on the parent
form.
I've taken some screenshots to clarify..

http://www.davestubbs1.f2s.com/Pics/Formwithsubform.jpg
http://www.davestubbs1.f2s.com/Pics/query.jpg
http://www.davestubbs1.f2s.com/Pics/queryresults.jpg

Once again, thanks
Dave


Ofer said:
If the query resault has only one record, then use DLookUp to retrieve the
value from the query

=DLookUp("[SumOfTime]","[Time total]")

--
\\// Live Long and Prosper \\//
BS"D


Anode123 said:
Hi,
I hope you can help me. I have a simple database with 2 tables. (the
database is used to store lesson plans) I have created a form with fields
from table1 with a subform containing fields from table2 (displayed as a
continuous form), all works OK. I have a field in table2 called "time", I
have created a query called "time total", to calculate the sum based on the
curent record from table1, and when ran, displays the desired result.
I created a text box, and using the expression builder, entered the following:
= [Time total]![SumOfTime] Which is the result of the query.
When the form is displayed, the box displays "#Name?"
I have checked out "help" to no avail..Please help
Thanks
Dave
 
Worked like a charm, Thanks Ofer..


Ofer Cohen said:
In that case
Create a text field in the SubForm form footer, not visible, and in the
control source of this field write

=Sum([Time FieldName])

On the Main form text box write
=[Sub Form control name].Form![Text box name created as specified above]


--
HTH, Good Luck
BS"D


Anode123 said:
Thanks for the quick reply Ofer.
The query groups by "table1", and then Sums the "time" field in "table2",
therefore the result contains all the records from "table1", and the summed
"time" field from "table2". The solution you provided gave me a result, but
it was the total for all records, not just the one in focus on the parent
form.
I've taken some screenshots to clarify..

http://www.davestubbs1.f2s.com/Pics/Formwithsubform.jpg
http://www.davestubbs1.f2s.com/Pics/query.jpg
http://www.davestubbs1.f2s.com/Pics/queryresults.jpg

Once again, thanks
Dave


Ofer said:
If the query resault has only one record, then use DLookUp to retrieve the
value from the query

=DLookUp("[SumOfTime]","[Time total]")

--
\\// Live Long and Prosper \\//
BS"D


:

Hi,
I hope you can help me. I have a simple database with 2 tables. (the
database is used to store lesson plans) I have created a form with fields
from table1 with a subform containing fields from table2 (displayed as a
continuous form), all works OK. I have a field in table2 called "time", I
have created a query called "time total", to calculate the sum based on the
curent record from table1, and when ran, displays the desired result.
I created a text box, and using the expression builder, entered the following:
= [Time total]![SumOfTime] Which is the result of the query.
When the form is displayed, the box displays "#Name?"
I have checked out "help" to no avail..Please help
Thanks
Dave
 
Back
Top