473,657 Members | 2,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comparing Two Fields Within the Same Table

2 New Member
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 3590
Seth Schrock
2,965 Recognized Expert Specialist
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 Recognized Expert Moderator MVP
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,568 Recognized Expert Moderator MVP
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 New Member
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 Recognized Expert Specialist
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
8333
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 possible to have conflicting data. I am looking to make a composite picture of a given security using the following rules: 1) The goal is to replace all NULL and Blank values with data
1
4828
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' 'Two' 4 1 'One' 'Two' 0 5 I need to sum up the number of times 'One' is greater than 'Two', and
2
21597
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
1865
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. Dance "events" do not change, only the months they occur. I have Attendee, EventTypes, Registration, and Classes tables. I need to add the following... To be able to track who is registering for particular dance classes
1
1770
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
1648
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 would like to cretae a many-to-many relationship 'within' the table. All of the records are related to zero, 1, or more 'other' records...all of which are located within this table. In reality, there is no unique criteria which leads to the link, the...
2
3314
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 07:47:00.000 FI0001258 M.MANIGANDAN Now I want to merge these 2 rows into a single row.The employee is present only if IOMode has both I and O else his presence is invalid. How to check whether the employee is present for that particular date? ...
3
1590
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 00/00/00 mask, and simultaneously going into Month field with MMM-YY mask. Thanks, Nick
1
1790
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 learn I will adapt & change.. but. currently I want to create a query which will show me records which Contain the word "Checked-In" in any of 4 columns. So for example: TABLE = Patient Visits Columns Interested Include: Visitor1Status ...
2
2064
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
8420
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
8842
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
8740
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
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
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
6176
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
4173
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...
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.