473,796 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to clean up a database

1 New Member
ok, so I've inherited a nightmare of an Access 03 database, and trying to clean up the admin and maintainence side of it. It's being used as a tool to provide revised credit card limits based on gross income and UMI (uncommitted monthly income). I've tried various ways, but keep coming unstuck, so any help would be appreciated.

Scenerio:

Table Client
Fields Client No
UMI
Gross Income
ProposedCreditL imitUMI

Basically, this last field is calculated value, based on a matrix taking the two values of gross income and UMI, and assigned a value.

The current query uses a formula that is unbearably long, and not friendly to changes, such as ranges and credit limits to be assigned. These do change, both in values, and number of ranges etc.

A cut down version of it looks like this - we may in the future add another UMI band, or condense them etc. This doesn't translate well in this post, so I hope it's clear enough.
Gross Income
UMI 25000-40000 40001-55000 55001+
0-50 5000 5000 6000
51-100 5000 6500 7500
101-150 6000 7000 8000
151-200 6500 8000 9000
200+ 7000 9000 10000

So, I'm after a query that takes the client UMI and Gross Income, finds where in this matrix it falls, and updates the Client_Table, Field ProposedCreditL imitUMI with the applicable value. Anything has to be better than the current built formula!
Dec 14 '07 #1
1 2167
FishVal
2,653 Recognized Expert Specialist
Hi, there.

It smells like you could benefit here greatly using database like approach to the problem.

The matrix could be represented by 3 tables with the following relationship.
For example

tblMatrixUMI
keyMatrixUMIID Autonumber(Long ), PK
lngUMILowerLimi t Number(Long)
lngUMIUpperLimi t Number(Long)

tblMatrixGrossI ncome
keyMatrixGIID Autonumber(Long ), PK
lngGILowerLimit Number(Long)
lngGIUpperLimit Number(Long)

tblMatrixValues
keyMatrixValueI D Autonumber(Long ), PK
keyMatrixGIID Number(Long), FK(tblMatrixGro ssIncome
keyMatrixUMIID Number(Long), FK(tblMatrixUMI )
lngValue Number(Long)

Limit and Value types may be double, but as soon as in example they are integers I've proposed fields of Long type.

Next - you make table join like the following

qryMatrix
Expand|Select|Wrap|Line Numbers
  1. SELECT tblMatrixUMI.lngUMILowerLimit, tblMatrixUMI.lngUMIUpperLimit, tblMatrixGossIncome.lngGILowerLimit, tblMatrixGossIncome.lngGIUpperLimit, tblMatrixValues.lngValue FROM (tblMatrixValues INNER JOIN tblMatrixUMI ON tblMatrixValues.keyMatrixGIID = tblMatrixUMI.keyMatrixGIID) INNER JOIN tblMatrixGrossIncome ON tblMatrixValues.keyMatrixGIID = tblMatrixGrossIncome.keyMatrixGIID;
  2.  
Thus you receive dataset which records contains matrix values with correspondent limit values.

Next - you join [Client] table to [qryMatrix].

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM [Client] INNER JOIN qryMatrix ON [Client].[Gross Income]>=qryMatrix.lngGILowerLimit AND [Client].[Gross Income]<=Nz(qryMatrix.lngGIUpperLimit,2000000000) AND [Client].[UMI]>=qryMatrix.lngUMILowerLimit AND [Client].[UMI]<=Nz(qryMatrix.lngUMIUpperLimit,2000000000);
  2.  
Note that if upper limit is not specified (assumed to be infinitely high and correpondent field is empty), then Nz() function is used to replace it with practically unreacheble 2000000000 - almost the limit of Long type values.

Voila - no formulas, matrix values are in tables so you may build a form to view/change them interactively, SQL is used instead of VBA which makes the solution fly like a rocket.

Hope this makes sense.

Regards,
Fish
Dec 14 '07 #2

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

Similar topics

8
4992
by: Craig Thomson | last post by:
I was wondering what people do with text provided by the user in a form. Some cleaning needs to be done at some stage if you are going to be putting it in a database or displaying it etc. But when is the time to do that? Do you clean it as soon as you get it? Do you pass around the original text and clean it when you use it? What about magic slashes? You need to addslashes before using in a db statement, but you need to strip them...
1
2662
by: intl04 | last post by:
I am getting strange print-related error messages when trying to create (not print!) reports. For example, when I click 'new' to create a report then choose 'design view', I get an error message that says: 'There was a problem retrieving printer information for this object. The object may have been sent to a printer that was unavailable.' When I choose 'report wizard', I can go through all of the steps but then I get an error message...
5
1996
by: Samuel R. Neff | last post by:
I'd like some opinions on whether or not to use IDisposable for classes that require clean-up but when the clean-up is not related to unmanaged resources or other disposable objects. The most descriptive case is unit test data. We have unit test data classes that generate fake data in the database which we can then test against, and then the unit test data classes delete those records. We can have all of these test data classes...
4
1807
by: Rick | last post by:
Hello, Below I create a static instance of an object, works well. public static BasicCounter GlobalCounter = new BasicCounter("GlobalCounter"); private void Page_Load(object sender, System.EventArgs e) { GlobalCounter.Increment();
2
2123
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error: The connection string specifies a local SQL Server Express instance using a...
4
1516
by: arak123 | last post by:
consider the following oversimplified and fictional code public void CreateInvoices(Invoice invoices) { IDbCommand command=Util.CreateDbCommand(); foreach(Invoice invoice in invoices) //lets say you have 200 invoices { command.CommandText+="INSERT INTO Invoice(Amount)
10
8222
by: teddysnips | last post by:
SQL Server 2000 (DDL below) If I try to run this code in QA: SET IDENTITY_INSERT tblAdminUsers ON INSERT INTO tblAdminUsers (fldUserID, fldUsername, fldPassword, fldFullname,
27
3863
by: jm | last post by:
I am having trouble understanding the purposes of an interface, even though the concept of interfaces is around me all the time (user interface, for example). I'm just not understanding software interfaces. Like anything else, it appears Interfaces are by design something that requires documentation. I know this may be obvious, but if I have a class A and I say, well, class A implements IMyInterface. The fact that it implements...
7
3794
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g. time / date Nice to have:
0
9685
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
9531
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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
10187
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,...
0
10018
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...
1
7553
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
5446
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...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3735
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.