Solved

avg calc on microsoft form

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

747 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

12 Experts available now in Live!

Get 1:1 Help Now