Solved

avg calc on microsoft form

Posted on 2013-01-31
3
333 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

809 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