Solved

How to get log totals in the tree view , another log database question

Posted on 2013-11-18
4
385 Views
Last Modified: 2013-11-20
Thank you all for your continued help on this.  I am learning a ton and get stuck at about every step of the way but I am getting closer to having a code base that I can work from by copying and pasting.  

The project tree footage is working.  I was able to get a nested loop of the calculation working.

Project Total
I know how to do the SQL now for what I need to do, but I can't see how to do it in one of these fields.  I need to show the individual log footage for each tree.

Log Footage
For example after selecting that first log and clicking on "View Logs" you get this screen and the total for that tree.

View Logs
If I go to the design view of the Tree Form and go to actions for the text field "txtCurrentLogFootage" it brings up the expression editor.  How do I do an SQL VBA query thing in there?
Database1683--2-.accdb
0
Comment
Question by:getwidth28
  • 2
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39658266
You're question is not very clear -- I think that is why it has gone unanswered for so long.

IF I understand correctly...

1.  You shouldn't store the CurrentLogFootage in your table.  Calculations like this should be made and displayed on the fly when needed in forms, reports and queries rather than stored in tables (there are a few exceptions to this rule of course, but this does not seem to be one of them).

2.  To accomplish #1, set the control source property of your CurrentLogFootage to the following (include the = sign at the beginning):

=DSum("(Round(((([Diameter] - 4) / 4) ^ 2) * [Length], 0))","tblLogs","treeID = " & [treeID] & " AND ProjectID = " & [ProjectID])

Open in new window

0
 

Author Comment

by:getwidth28
ID: 39659482
Shucks, I tried to explain as well as I can.  I will try what you put probably this afternoon when I can.  If I need to I will explain better.   Thank you

I wasn't hinting at needing to store the calculations in the table, I changed my thoughts on that from this board (may have been you telling me).  I just know it would be easy to put the field in the txt box vs. a SQL Query.

Man that line is a mouth full.  How do you guys keep that stuff straight.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39660125
--->> How do you guys keep that stuff straight.

It is actually 95% what you had already written.  I just wrapped it in a function and added criteria.

The domain functions (DSum, DAvg, DLookup, etc)  are a very common way to 'query' single values to display in textboxes.

Jim Dettman has a great article detailing their usage here:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12-Dlookup-and-the-Domain-Functions.html
0
 

Author Comment

by:getwidth28
ID: 39663869
I plugged that in exactly how you wrote it and it worked right away.  Brilliant.  Thank you
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 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