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

Comparing Two Fields Within the Same Table

2
I have a database of rents for all of my company's offices. I want to create a query that shows when there is an increase or decrease.

I would like a returned phrase like INCREASE, DECREASE, SAME, or STOPPED when the query runs.

I have tried many different codes and none worked with error messages such as bad syntax and etc.

Thank you for any and all help.
Jul 29 '15 #1
5 3570
Seth Schrock
2,965 Expert 2GB
Assuming that you are wanting to compare two fields in the same record, you could use the Switch function either in a query or in a textbox's control source.
Expand|Select|Wrap|Line Numbers
  1. Switch(Field1 > Field2, "Increase", Field1 = Field2, "Same", Field1 < Field2, "Decrease", Field1 Is Null, "Stopped")
Jul 29 '15 #2
Rabbit
12,516 Expert Mod 8TB
If you are not talking about two fields in the same row, then you have not given us any information about your data and how it's structured and we can't help you without that. All we can say is join the table to itself to get your two related rows together.
Jul 29 '15 #3
NeoPa
32,556 Expert Mod 16PB
I would guess that Rabbit has this right Kim.
You need to give us the full question with the basic details if you want us even to be able to help you.

We want to, but you need to ensure we have the basics at least in order to be able to.
Jul 30 '15 #4
KimE
2
Yes, the fields are in the same row. The column headers are the months and year (AUG-2015, SEP-2015, etc) and the first cell of each row is the office name.

I hope this helps.
Aug 3 '15 #5
Seth Schrock
2,965 Expert 2GB
Then my solution in post #2 would work. However, it seems like your database isn't normalized. Problems like this become a whole lot simpler in a normalized database. See Database Normalization and Table Structures.
Aug 3 '15 #6

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

Similar topics

6
by: Jason | last post by:
I need to populate a table from several sources of raw data. For a given security (stock) it is possible to only receive PARTS of information from each of the different sources. It is also...
1
by: Chris | last post by:
I have the following table structure. group1 group2 group1_result group2_result 'One' 'Two' 3 2 'One' 'Two' 3 1 'One' 'Two' 2 5 'One' ...
2
by: cyder | last post by:
Hi All I want to create a filter that will detect whether I have the same value in say field 3 and field 4. Could you please tell me how to do this? Thanks Cydernet
4
by: jean.ockert | last post by:
Greetings. Access version 2003 on an XP system I am using the template "Event Management" database as the primary database and need additional functionality added. I have a dance studio. ...
1
by: swtrader | last post by:
I need to find the earlier of two separate dates in the same table and populate a field in the same table with the earlier date.
0
by: khoegen | last post by:
Folks, I am in the process of designing a database, within which I have created a table called "tblDOCUMENTS". As the title suggests, this is a list of documents (records) of varying types. I...
2
by: sudhaMurugesan | last post by:
Hi, I have a table like this. IOMode Date EmployeeID EmpName O 2007-02-28 16:46:00.000 FI0001258 M.MANIGANDAN I 2007-02-28...
3
by: nsymiakakis | last post by:
Hello everyone, is it possible to have one form field entry populate two different field in the same form. i.e. Date field of form inputting 5/4/07 and this going to Date field on table with...
1
by: cronk005 | last post by:
I am fairly new to Database creation and have devised a nice database which does what I am hoping to do. Though I am sure there is an easier way of accomplishing many of the tasks I have done, as I...
2
by: peterbata | last post by:
Table looks like this: custno custname qty active banner My simple query so far looks like this: /****** Script for SelectTopNRows command from SSMS ******/ SELECT ALL , ,
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.