473,385 Members | 2,004 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,385 software developers and data experts.

Get Value from Previous Record for this record

Is it possiable to have a iif function in a query where it looks at
the next record. for example if I run the query which lists years and
if the results in record 2 equals the result in record 1 then it
displays an X.

Mar 7 '07 #1
3 25536
Use a subquery to read the value from the other row in the same table.

Example:
http://allenbrowne.com/subquery-01.html#AnotherRecord

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chris" <ch*********@gmail.comwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...
Is it possiable to have a iif function in a query where it looks at
the next record. for example if I run the query which lists years and
if the results in record 2 equals the result in record 1 then it
displays an X.
Mar 7 '07 #2
On Mar 7, 3:20 am, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
Use a subquery to read the value from the other row in the same table.

Example:
http://allenbrowne.com/subquery-01.html#AnotherRecord

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Chris" <chrislab...@gmail.comwrote in message

news:11**********************@v33g2000cwv.googlegr oups.com...
Is it possiable to have a iif function in a query where it looks at
the next record. for example if I run the query which lists years and
if the results in record 2 equals the result in record 1 then it
displays an X.- Hide quoted text -

- Show quoted text -
I a newbie to access and that seems way over my head, if there a way
to do it in design view???

Mar 7 '07 #3
On Mar 7, 8:57 am, "Chris" <chrislab...@gmail.comwrote:
On Mar 7, 3:20 am, "Allen Browne" <AllenBro...@SeeSig.Invalidwrote:
Use a subquery to read the value from the other row in the same table.
Example:
http://allenbrowne.com/subquery-01.html#AnotherRecord
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Chris" <chrislab...@gmail.comwrote in message
news:11**********************@v33g2000cwv.googlegr oups.com...
Is it possiable to have a iif function in a query where it looks at
the next record. for example if I run the query which lists years and
if the results in record 2 equals the result in record 1 then it
displays an X.- Hide quoted text -
- Show quoted text -

I a newbie to access and that seems way over my head, if there a way
to do it in design view???
I a newbie to access and that seems way over my head, if there a way
to do it in design view???
This is easy to do in Excel, but part of the point of a database is
that the rows are not related to each other. What you are looking to
do is not hard, but takes doing a few steps:

copy the data into a new table called newTable with a new serial
number field called serial. (unless you already have a serial field
that has no gaps)

Create a query based on newTable called newQuery. Add a calculated
field called nextRecord: = serial + 1, as well the year field and any
other field you want

Make a new query called results that includes the new table and the
new query, joined from serial to nextRecord

make a calculated field in the new query called isEqual: =
iif(newQuery!year = newTable!year,"X","")

You can use any field, table, or query name you want.

There you have it. hth.

Mar 8 '07 #4

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

Similar topics

5
by: Derek Cooper | last post by:
I hope you can help me. I posted this in the microsoft sql server newsgroup a few days ago and got no response so I thought I'd try here. If I can provide any clarification I'll be glad to do so....
1
by: koen colen | last post by:
Hello group, I hope you guys can help me out, I am modifying a piece of code from Joe Norman, I did found the code here: http://www.intranet2internet.com/public/default.asp?PAGE=sscript&ID=3 ...
4
by: Gene | last post by:
When entering a record in a form, I would like a value in a field of the previous record to be entered automatically into a different field of the current record. Which way should I go? Is it also...
2
by: Steve | last post by:
Does any anyone have a procedure for a query where a calculated field returns the previous record's value in another field. For example: A F A Z F M Z The primary key is in random...
3
by: Phil | last post by:
Newbie to Access so am having a BIT of difficulty. I am trying to get a field value in a new record to equal the value of the same field of a previous one. For instance, Field1 + Field2 =...
2
by: nasse | last post by:
i found this code on the internet that copy value from the previous record to the new record. Private Sub Ordrenummer_AfterUpdate() Const cQuote = """" Me!Ordrenummer.DefaultValue = """" &...
2
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
8
by: Jeff | last post by:
A client wants a press of the Enter key in a field on a continuous form to grab the value of that field from the previous record. But if they have typed a value and then hit Enter it shouldn't. ...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
2
by: David Jackson | last post by:
Hello, I'm using VS.NET 2005. I have a ListView populated with data pulled from a SQL Server database. I have wired up a SelectedIndexChanged event, but I can't find any way of retrieving...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.