473,387 Members | 1,493 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,387 software developers and data experts.

Please Help... Making Comparison Between 2 Years

Dear Access 2000 users,

We have two tables, named 2003 and 2004. Each table contains 3
fields. User Name, Period (numbered from 1 to 26), and Amount. We'd
like to compare amounts from period to period for the two years for
each user.

Here's my problem - some of the users don't have all 26 periods (e.g.
they started in period 3 of 2003). Is there any code to go through
and see if period 1 exists for each user, and if it doesn't, add a new
record with the user name and a $0.00 amount in the Amount field? And
then check period 2, and 3, etc.?

If it helps, I have a seperate table of all the user names.

Thanks a million in advance!

Kev
Nov 12 '05 #1
4 1521
No Spam wrote:
Dear Access 2000 users,

We have two tables, named 2003 and 2004. Each table contains 3
fields. User Name, Period (numbered from 1 to 26), and Amount. We'd
like to compare amounts from period to period for the two years for
each user.

Here's my problem - some of the users don't have all 26 periods (e.g.
they started in period 3 of 2003). Is there any code to go through
and see if period 1 exists for each user, and if it doesn't, add a new
record with the user name and a $0.00 amount in the Amount field? And
then check period 2, and 3, etc.?

If it helps, I have a seperate table of all the user names.

Thanks a million in advance!

Kev


Create a temp, junk table. Call it tmpPeriod...1 field called
Period...enter values 1-26.

Create another query will select all employees. QEmp

Create another query. Add table Period and Qemp. Drag the Period and
EmpID or Name to the columns. Make this a MakeTable (from Menu
Query/MakeTable). New Table name is tmpPeriodEmp. This is a cartesian
join query that will create 26 records for each employee and store the
results in table tmpPeriodEmp.

Now you create another query. Add the tables 2003 and tmpPeriodEmp.
You sould make this query via the FindUnmatchedWizard unless you know
how to do that. Now drag down the field names Period, EmpID/Name from
tmpPEriodID and make this an AppendQUery (from Menu, Menu/Append. You
can then fill in the dollar amounts later with an update query.

Delete any tmp tables and Qemp when done. Make a copy of 2003 before
you run.
Nov 12 '05 #2
No Spam <no****@earthlink.net> wrote in message news:<de********************************@4ax.com>. ..
Dear Access 2000 users,

We have two tables, named 2003 and 2004. Each table contains 3
fields. User Name, Period (numbered from 1 to 26), and Amount. We'd
like to compare amounts from period to period for the two years for
each user.

Here's my problem - some of the users don't have all 26 periods (e.g.
they started in period 3 of 2003). Is there any code to go through
and see if period 1 exists for each user, and if it doesn't, add a new
record with the user name and a $0.00 amount in the Amount field? And
then check period 2, and 3, etc.?

If it helps, I have a seperate table of all the user names.

Thanks a million in advance!

Kev


1. use the wizard to create a union query of 2003 and 2004.
2. create a table of Periods. Insert values 1-26.
3. create a cartesian product of period X username. (all combinations
of (username,period), so you'll have some multiple of 26.)
4. run the find unmatched query wizard and use the result of step 3
with the result of step 1.
5. turn that into an append query...
6. run said query...

(well, that's the short answer.)
SELECT User Name, Period, Amount, Year
FROM tbl2003
UNION ALL
SELECT User Name, Period, Amount
FROM tbl2003
Nov 12 '05 #3
No Spam <no****@earthlink.net> wrote in
news:de********************************@4ax.com:
Dear Access 2000 users,

We have two tables, named 2003 and 2004. Each table contains
3 fields. User Name, Period (numbered from 1 to 26), and
Amount. We'd like to compare amounts from period to period
for the two years for each user.

Here's my problem - some of the users don't have all 26
periods (e.g. they started in period 3 of 2003). Is there any
code to go through and see if period 1 exists for each user,
and if it doesn't, add a new record with the user name and a
$0.00 amount in the Amount field? And then check period 2,
and 3, etc.?

If it helps, I have a seperate table of all the user names.

Thanks a million in advance!

Kev

Why go to all that trouble?

Create a query, with tables 2004 and 2003
join the tables on user name -> user name, and period -> period.
Double-click on each join line. change the join type to show ALL
Recods from table 2004 and only tohose from 2003....

Now fill in the grid with the three fields from 2004.

In the fourth field, enter the following statement:
2003Amt: nz([2003].[amount],0). Open the properties popup and set
format to currency, decimal places to 2.

save and run the query.

Bob Q.
Nov 12 '05 #4
Thanks for all the help, I got it! I really appreciate it!

Kev
On Mon, 03 May 2004 21:34:56 GMT, No Spam <no****@earthlink.net>
wrote:
Dear Access 2000 users,

We have two tables, named 2003 and 2004. Each table contains 3
fields. User Name, Period (numbered from 1 to 26), and Amount. We'd
like to compare amounts from period to period for the two years for
each user.

Here's my problem - some of the users don't have all 26 periods (e.g.
they started in period 3 of 2003). Is there any code to go through
and see if period 1 exists for each user, and if it doesn't, add a new
record with the user name and a $0.00 amount in the Amount field? And
then check period 2, and 3, etc.?

If it helps, I have a seperate table of all the user names.

Thanks a million in advance!

Kev


Nov 12 '05 #5

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

Similar topics

7
by: Christopher Jeris | last post by:
I am relatively new to JavaScript, though not to programming, and I'm having trouble finding the idiomatic JS solution to the following problem. I have a table with (say) fields f1, f2, f3. I...
16
by: ranger | last post by:
Hi, I'm a beginner with C++, studying on my own from a book and I've encoutered quite some problems.. If possible, someone out there might help me out.. The problem is the following.. I've...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
2
by: No Spam | last post by:
Dear Access 2000 users, We have two tables, named 2003 and 2004. Each table contains 3 fields. User Name, Period (numbered from 1 to 26), and Amount. We'd like to compare amounts from period...
11
by: dhnriverside | last post by:
Hi peeps Ok, so I thought I'd have a go at making a console app in VS2k5... I haven't written any windows apps for years, let alone dos apps (been web programming) and I've hit a dumb error... ...
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
21
by: salad | last post by:
Thanks for reading this post and wasting your time. I was thinking about writing about the PCDatasheet vs The Pussyfarts war. The pussyfarts, as near as I can tell, have little to offer this...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
118
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
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,...
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.