473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Result of DAO expression visible as a new column in a table/query

I would like to see the result of DAO expression as a new column in the underlying table/query.

To be more precise, what I get as a result of debug.print I would like to get in a new column, i.e. how can I see the value "ell" which I calculate in the loop in some new column (please see code) ?

The sub calculates the relative change of some value (EAD) IF it belongs to the same client (ID).

Public Sub cloneX()


Dim rst As DAO.Recordset
Dim db As DAO.Database

Set db = CurrentDb()
Set rst = db.OpenRecordset("PL_TEST_CLONE", dbOpenDynaset)
rst.MoveFirst
Set rst2 = rst.Clone

rst2.MoveFirst
Set ull = rst!EAD
Set ill = rst2!EAD

Set ID = rst!MBR
Set ID2 = rst2!MBR


On Error GoTo err_handler


rst.MoveNext

Do While Not rst.EOF
If ID2 = ID Then
ell = (ull - ill) / ill
Else
ell = 0
End If
Debug.Print ell

rst.MoveNext

rst2.MoveNext

Loop


Exit_Arh:
Exit Sub

err_handler:
Select Case Err.Number
Case 440
Resume Exit_Arh
End Select

End Sub
Aug 2 '16 #1
1 813
Seth Schrock
2,965 Expert 2GB
I think that you would be better off using a query and joining the table to itself and then have your calculation as another field.
Aug 4 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Heist | last post by:
Hi, I just want to know to turn this: CREATE TABLE . ( NOT NULL , (50) COLLATE French_CI_AS NULL , NOT NULL , (50) COLLATE French_CI_AS NOT NULL , NULL , NULL ) ON into this:
11
by: Peter Foti | last post by:
Hi all, I have a form that contains a 2 column table. In the left column is the description for a particular input (ie - "First Name", "Last Name", "Phone Number", etc.). In the right column...
4
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table...
10
by: ste | last post by:
Hi there, I'm trying to query a MySQL database (containing image data) and to output the results in a HTML table of 3 columns wide (and however many rows it takes) in order to create a basic...
3
by: milam | last post by:
Greetings, I would like to use a query result as a column name in another query, I can't seem to get this to work using Subqueries. Is there a good way to do this? Example: Table...
3
by: Beejer | last post by:
I'm currently having a hard time getting my expression to run in my billing query. My setup: MS Access 2003 Qry Billing (includes 6 tables such as Client, Price list, Formula, Order, Order...
2
by: Merio | last post by:
I want to save a query result to a new table. Is this possible using sql commands? Like: Select Col1, Col2, Col7 from tbl1 Order by Col1 - Save it to tbl2 using the same column headers generated...
4
by: Captain Jack Sparrow | last post by:
I have a column in a table named "Hospice". I have a make table query that pulls in this column but renames the column in the result to "Hospice (Yes/No)". The column name in the resulting table is...
16
by: kinkin83 | last post by:
Dear All, i would like to get different result from 1 column in 1 query. the details result is below database name: Data table name: table1 column: id, phoneno, timeframe, mo if MO=1 means...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.