473,721 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating Table With Calculated Report Values

Here are the relevant "givens" to my problem...

Form: frmLaunchRpt
- Text Box: txtAsOfDate
- Check Box: chkLogEval
- Command Button: cmdLaunchRpt

Report: rptEvaluation
- Text Box: txtGreen (Percent of items on schedule)
- Text Box: txtYellow (Percent of items slightly off schedule)
- Text Box: txtRed (Percent of items greatly off schedule)

Here is a sample of what information I want to output and store on a
table...

Table: tblLogEvaluatio n

[Date] [Green] [Yellow] [Red]
txtAsOfDate(1) txtGreen(1) txtYellow(1) txtRed(1)
txtAsOfDate(2) txtGreen(2) txtYellow(2) txtRed(2)
txtAsOfDate(3) txtGreen(3) txtYellow(3) txtRed(3)
..
..
..
txtAsOfDate(n) txtGreen(n) txtYellow(n) txtRed(n)

The problem...

I have a percentage calculation in the report footer of my
"rptEvaluat ion" report. The information in the footer of the report
needs to be logged to a table, but not every time the report is run.

To accomplish this, the user will have a check-box selection called
"chkLogEval " on a form (frmLaunchRpt) that launches rptEvaluation. So
the information in rptEvaluation will ONLY be logged to a table when
the condition chkLogEval = TRUE. The user presses the launch button
(cmdLaunchRpt) to open the report.

The Solution...

I want to write a VBA script under the "On Open" property of
rptEvaluation to check to see if chkLogEval = TRUE. If it is, then it
will append an entry to tblLogEvaluatio n, retrieving the fields shown
in the sample table.

Please assist me with the proper coding to solve this problem.
Thanks in advance.

Nov 13 '05 #1
1 2487
Greetings,

You won't be able to retrieve the calculated value from the Report Open
event because that is where the calculation is taking place. You can
retrieve the calculated result in the Detail Event. Note: If you have
several records but only one calculated result, you may want to add a
boolean flag so that you don't keep retrieving the same value.

You can use basic sql to retrieve the value in the Detail Event like
this:

Dim bGetData 'declare boolean var at module level of report

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If bGetData = True Then
if Forms!frmLaunch Rpt!chkLogEval = True Then
DoCmd.RunSql "Update tblLog Set PercentVal = " & txtPercent
bGetData = False
End If
End If
End Sub

Private Sub Report_Open(Can cel As Integer)
bGetData = True 'set boolean var to true here
End Sub

This code assumes that the Table field (PercentVal from tblLog) which
will receive the value from the report is a numeric field and thus does
not require delimiting with single quotes like a string value would when
using Sql.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5617
by: Sidney Linkers | last post by:
Hi, I'm trying to make a calculated text field in a query where the textvalue is being populated from multiple records. I already use a VBA function to loop through records and concatenate the text. It works but the performance is really bad. I'm looking for a solution in plane SQL, so the looping is done by joining tables. I can't get it to work....
3
3162
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and populate a combo box with these names. (this way, I can display all the EMPLOYEE_NAME values) (2) In general, can I do additional processing on column values from
1
2969
by: tconway | last post by:
I have an Access program that displays Customer data into a form and OrderID data into a subform. The totals in the Subform are based on calculated fields, i.e. the Total Amount field Calculates the following: =* The Subform Order fields are pulled from a Query along with each calculated Total. They are displyed in a DataSheet View. This works fine on my developement environment which includes a server set up just as our client has. ...
3
2176
by: otac0n | last post by:
How can I select the maximum value from a field, but make sure that the value i want stays greater than a cetrain value? I currently have this: SELECT A.rating, B.rating, 1/(1+10^((A.rating-B.rating)/400)) AS Expected, Round( -20*( .+. ) / (
18
3796
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having trouble. I have tried keeping some of the fields bound and when I use the save button it has been saving as 2 different records. This is unacceptable. This is what I have, can anyone help me out with this?
9
4999
by: Mohd Al Junaibi | last post by:
Hello all, my first post here...hope it goes well. I'm currently working on stored procedure where I translated some reporting language into T-SQL The logic: I have a group of tables containing important values for calculation. I run various sum calculations on various fields in order to retrieve cost calculations ...etc.
8
3661
by: Gilberto | last post by:
Hello, I have created a query to help me calculate some total values i need for a report. In the query field i have the following: TCL1: Costing!*(Engineering!+Engineering!) The results are calculated correctly for the report, however now i need this calculated values (from TCL1 on the query) to be stored in a table (COSTING) under the same field name (TCL1).
3
1471
by: Connell | last post by:
I have an Access 2003 report that has multiple calculated values. Now I need to use one of those values in a subform. Is there a technique in Access similar to SetValue so a calculated report value can be transferred to a table field?
5
1792
by: royals | last post by:
Hello Access gurus, I am a self-taught Access “developer” and have a ton to learn so please allow me to sound stupid. I am using 2003 on a XP platform. I manage properties for an organization. At times it is necessary to pay an individual to stay in a house so that it isn’t vacant for an extended period of time. The organization pays the entire utility cost but deducts the individual’s usage cost. In other words, they receive...
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.