Solved

avg calc on microsoft form

Posted on 2013-01-31
3
323 Views
Last Modified: 2013-01-31
Hello
attached database-
open database- form opens
click button- enter [101] for item code and [jim] for name.
A form displays- I want to code the unbound textbox-
Have tried =DAvg("[Time Spent]","Table1", [Item Code]='" & Me![Item Code] & "'')
( receive error "expression you entered has invalid string")

the avg time spent displays the avg time jim ( or anybody you select) spent-
I want the total avg time spent- to display average time for everbody- on the item code selected

thank you-
DB201.accdb
0
Comment
Question by:davetough
3 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38840407
I cannot open your database (corporate policy).

Are you certain the [Item_Code] field in your table is  a string, and not numeric?  If numeric,
try:

 =DAvg("[Time Spent]","Table1", [Item Code]=" & Me![Item Code])
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 38840480
Couple of things...
You can't use 'me' in a controlsource expression.  It has to be the full form reference.
Some of your quotes were awry.

=DAvg("[Time Spent]","Table1","[Item Code]='" & [Forms]![form2]![Item Code] & "'")
0
 

Author Closing Comment

by:davetough
ID: 38840519
thank you
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now