Problem with " #Name? " when adding unbound to form.

JimJones

Registered User.
Local time
Today, 15:53
Joined
May 6, 2003
Messages
78
Hi.

I thought I had this problem solved.

I have a query which calculates beginning and ending mileage, and displays the miles driven for that record.

Then, I decided I wanted a total of ALL the miles to be displayed onto the single form, which has a single underlying table,
(with my 2 queries.)

OK, so the table consists of beginning and ending mileages.
I have 2 queries: One calculates the mileage for the one day, by subtracting the beginnig from the ending vehicle mileage.

Then, I had to create a second query to total the "expr" column from the first query. So, this second query simply displays the total of all the mileage records as one lump sum, which is fine.

I now want to get this sum onto my main form, so I can see it increment with every record I enter/update.

But, I set an unbound field, and tried various places in which to place my expression. All I get is the #Name error, and I'm positive everything is spelled right because I used the builder . . .

Please help,

Thanks,
Jim
 
The expression is:

=[qryTotalMiles]![Sum Of Expr1]

And, it's in "control source", of the unbound box.

"Expr1" is the 3rd field in my first query, which does the substraction operation to result the miles for that record.
That expression above was built using the wizard ...


Can you please help?

Thanks,
Jim
 
You can't reference a field of a table or query in a textbox's ControlSource. A textbox can only show one piece of information; a table or query can return multiple records.

Try:

=Sum([Expr1])
 
OK,

I tried =Sum([Expr1]) and now I just
get #Error

I put the above expression in the same place where I had the previous one.

Please help, and thank you,

Jim
 
Sum of Expr1 implies that you are querying a query.

If you are just looking to total a field in a query then you can abolish the second query and just use the expression given above. Provided, of course, that the original query is bound to the form.
 
Yes, indeed I am querying a query.

The first query gives me the records from the daily mileages.

The second query totals all those daily mileages to return one figure, which I get (both queries work fine). Would just like to display the total query on the form.

You mentioned to make sure that the query is bound to the form.
I'm probably having this problem because I may not be sure about that.

Please elaborate on the bound issue,
Thanks,
Jim
 
Hi,

In the 2nd query I made, the only thing in there is the following expression at the top of one of the columns:

Sum Of Expr1: Sum([qryCalcMiles].[Expr1])

Can I provide any more info?

Thanks,
Jim
 
Okay, I'm saying "ditch the second query"

In the textbox ControlSource, put:

=DSum("[Expr1]", "qryCalcMiles")

That's a function that will total the field for you. I was, somehow, under the impression, that the first query was bound to the form.
 
Yes ! That's it !

It works.

Thank you, Oh thank you,

Jim
 

Users who are viewing this thread

Back
Top Bottom