473,834 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

if/then query

Hello,

I have 3 tables in my mdb file, one contains a list of definitions, one
is a list physical items, and one is a list overrides. Normally my
query will join the definition physical item tables, sharing an id
number (e.g. in my defintion file I may have a table item and its
price, item number, etc; in my physical item table I may list sales
date, purchaser etc; the query result will combine these).

Sometimes I would like to override one of the definition columns with a
value in an override table. Is it possible to write an SQL query in
access that does this? I imagine something using the IIf operator.
Thanks,

Jeff

Nov 13 '05 #1
1 1903

Make a join of all three tables, and extract a column
Result: iif ( [tblOverride] is null;
[tblDefinition].[columnX];[tblOverride].[ColumnXorY])
(type this in the top-row of the bottom half of your query-design-view)

Make sure you have a left-join to the override table (arrow pointing to
override), because you'd miss records otherwise. To make sure, first select
your results, note the recordcount, and than add the override-table to your
query. If the recordcount is the same, it's OK.

Bas Hartkamp

<JB*****@gmail. com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello,

I have 3 tables in my mdb file, one contains a list of definitions, one
is a list physical items, and one is a list overrides. Normally my
query will join the definition physical item tables, sharing an id
number (e.g. in my defintion file I may have a table item and its
price, item number, etc; in my physical item table I may list sales
date, purchaser etc; the query result will combine these).

Sometimes I would like to override one of the definition columns with a
value in an override table. Is it possible to write an SQL query in
access that does this? I imagine something using the IIf operator.
Thanks,

Jeff

Nov 13 '05 #2

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

Similar topics

3
1767
by: Chris Tilley - HPC:Factor | last post by:
Hi, I'm utterly confounded by this one. There must be some sort of rule that I don't know of. I'd consider myself a Newbie+1, so be gentle. I have a database connection (working A-Ok) and a Query String value from a form (passed using GET & working Ok). The server is IIS5. What I'm trying to do is get a simple IF statement to work accross the two numeric values. Once from a database and one from a Query String.
2
2179
by: Tony Kennedy | last post by:
Hi, We have a SQL server db backend for our ERP system. I have written a Crystal Report to extract data from one particular table called itemspecbomw (c.30000 records) which contains amongst other things Bill of Materials costings. When I run the report I know that some rows are missing as when I look at values through the ERP system itself, the values are different. What I have found is that when I run the equivalent ERP system...
3
1523
by: Koen | last post by:
Hi all, I have created a nice working database for keeping track of helpdesk calls, corrective actions etc. To determine a certain status (for example what calls are ready for test, after all actions have been finished) I created queries. Because these statusses are depending on more than one parameter, I would like to automate the status setting. So my idea is to put IF...THEN logic underneath AfterUpdate events of all
1
1280
by: Astra | last post by:
Hi All Strange request I know, but could somebody give me pointers on how I can put 3 queries into 1 'thing' and then get only the unique entries from this 'thing'. To explain, I'm using Excel/VBA/ODBC to query an SQL DB. The 3 queries themselves aren't that complex and all return the same 2 fieldsets of stock code and stock desc. Because these separate queries might bring back the same stock code/description I need to amalgamate...
6
2353
by: JackM | last post by:
I have a multiple select input in a form that's being populated by a row from my database as such: <input type=\"checkbox\" name=\"subm\" value=\"$row\"> That part is working fine as I can check the displayed page using View Source and see that the value is the correct row number from the database. It is then being submitted on a form by $_POST method to another page where I want to evaluate the checkboxes and display the contents of...
2
2446
by: Daniel Di Vita | last post by:
I have created an ASP.NET page that allows the user to page through a result set. I need to expand on this. On that same page I a filed where the user can type in a search string. When they click a button ALL the results will be returned and the closest match to the search string will be highlighted. The approach I am taking to page the data is to put the keys/indexes into an array then create another data reader based on those results to...
0
2620
by: kamii47 | last post by:
I am creating in memory xmldocument.Previously I were validating my file against a dtd file and then by the help of GetElementByID read my needed node. i.e. XmlDocumentType doctype = null; doctype = statementsDocument.CreateDocumentType("queries", null,statementsPath +"\\Validation.dtd", null); statementsDocument.AppendChild(doctype); nodeElem = statementsDocument.CreateElement("queries"); statementsDocument.AppendChild(nodeElem); ...
1
1853
by: mamun | last post by:
Hi All, I am doing it for the first time in C# (using Visual Studio 2005), First I need to check if data exists in a table for a variable. If so then run the second query and display the resultsets in Gridview. For ex., in the form I am entering contract id and running the query for that contract id. If results found then use that contract id to run the second query and show the results in gridview.
6
6325
by: AdmiralXizor | last post by:
I have written a function that executes action parameter queries given a name and a list of parameters. It splits a string into an array, passes the parameters to the (already saved) query name, then runs the query using the Execute method, etc., then writes a record to a table that logs the name of the table and whether the query works or not. The function has worked flawlessly for over a year; I have used it in ACC2000 and ACC2002, in...
1
1601
by: berio211 | last post by:
What I am trying to do is create a query in Access that will help in my Worker's Comp reporting. I already have queries set up but I am missing one component. I have a query that states IF payrollold is greater than 750 THEN 750 IF not THEN payrollold. However I need to add a twist in that I need to add a statement which would give me the following result: IF hours is greater then 80 THEN 1500 (in the payroll column) IF not then 750. I am...
0
9799
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
10795
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
10512
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...
1
10550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7760
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
6957
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
5627
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...
1
4427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3981
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.