Solved

avg calc on microsoft form

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

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