Subtract One Table From Another?
Aug 11, 2006
Hi, I hope someone can help me out with this problem:
I have 2 tables with identical stucture, and no unique ID number.
Both had identical data, and the databse was then copied onto 2 laptops. Now further data was added onto each.
I want to now merge the three databses (ie original one, and 2 laptops) into 1, without creating duplicates- so I need to identify which are the new fields added to the databases. I figured that by somehow subtracting the original table from the new ones, i would be left with the new data, but dont know how to do this. Or is their another way?
View Replies
ADVERTISEMENT
Apr 23, 2015
I have a database to keep track of time spent on development work. The database uses mainly two tables: Estimates and Status.
The Estimates table holds a static number for each item to be worked on. We generally subtract this number from the total number of hours in Status spent on each of the items. In queries, to calculate the overall delta, we subtract the Estimate from the overall Status for each item.
However, we would like to create a report that gives us a running total for each item. So, if we have 100 hrs in the Estimate table for Item A and 5 hrs for item B, then the report would ideally show something like this (delta between Status table and static value in Estimate table):
Code:
Item | Resource Name | Estimate | Actual | Delta
--------------------------------------------------------
A John Doe 100 10 -90
A Jane Doe 90 5 -85
A John Appleseed 85 5 -80
B John Doe 5 10 5
B Jane Doe -5 5 10
This is so that we can see how our actual hours spent working on a task line up to our estimates. So, if we are under estimating our work, we can easily see this.
In Excel, this is of course no issue, but it becomes an issue when trying to write a query in Access to report this information.
As I said, we can do the overall numbers, just not the line item numbers.
View 14 Replies
View Related
May 22, 2013
I have a table in wich I have stored numbers and i want to subtract them using vba.
example
Table1
ID number
1 20
2 40
textbox(ID):2 texbox(value):5 button(subtract)
So when i click button i want to subtract record with id 2 (40-5=35) and i want the new value to rewrite the previous one in the table.
result:
Table1
ID number
1 20
2 35
I want to know if it's possible to do this in vba.
View 8 Replies
View Related
Sep 26, 2014
I have a form with a textbox, listbox and a button.
my textbox is based on one of my tables, and when I enter a value (which is saved in my table) in my textbox and press enter, certain values in my table goes to my listbox, and my listbox will just additem whenever I do same thing in my textbox all overagain.
how can I subtract listbox.column(1) items in my table field "Item_Quantity" where my Listbox.column(0) is equal to my table field "Item_Description".
My Listbox column count property = 4
Row source type = value list
View 1 Replies
View Related
Oct 31, 2012
Any way of setting up a table containing the following date/time fields.
StartDate
StartTime
EndDate
EndTime
Ultimately I will need to be able to subtract these date/times to get a total time between the two. Should I combine the start date and times in one cell or keep them separate.
In either scenerio, how do I subtract the two in a query for a report?
View 1 Replies
View Related
Mar 31, 2014
I have two tables (one is a query)
Table 1 (query based)
EMP_ID
Prev_Emp_ID
EMP_ID_DDSK
332-123
1
500
332-133
1
501
332-144
0
332-156
1
502
332-654
1
503
332-456
1
504
332-967
0
Table 2
Res_Numbers
Num_Of_Employees
500
10
505 - after 5 numbers are placed
Will be added for next hire
My goal: to place employee numbers into new employee field "EMP_ID_DDSK" (table 1), Numbers will come from (from "Res_Numbers" field (table 2)
Example: If field "Prev_Emp_ID" = false
Get the next number in line from table 2 "Res_Number" and place it in table 1 field "EMP_ID_DDSK".
Example: if "Prev_Emp_ID" = false for 5 new employees. Take the next set of numbers and place into field "EMP_ID_DDSK".
View 4 Replies
View Related
May 15, 2015
I have a 'tblStock' with fields 'ProductID', 'InitialStock', 'Buy', 'Sell' and 'UpdatedStock'. I also have a form 'StockUpdate' add values and also add new records to 'tblStock' .
If I have value [100] for IntialStock quantity, Buy [0] and sell [10], UpdatedStock will be [90] (that's done and fine!).
The problem is, I would like to make the UpdatedStock value [90] to be the NEW InitialStock, so that any BUY or SELL will keep updating the UpdatedStock and making it the NEW InitialStock for the next transactions and so on....
View 8 Replies
View Related
Aug 16, 2007
Hi
I want to make a button which when clicked will bring up a box which the user will enter a number which will then be subtracted from a number in a field.
I have tried an update query however not been able to getting it working.
Any ideas?
View 5 Replies
View Related
May 20, 2006
Hi,
I have a query with two fields. One has the "MEASUREMENT" and the second one is the month containing the values. In the MEASUREMENTs I have gross revenues and discounts, how can I create a new MEASUREMENT (net revenue) that is calculated by subtracting the discounts from the gross revenue.
Regards
Giannis
View 1 Replies
View Related
Feb 16, 2007
:confused: Need help building a query that will subtract the previous value from the next value at each change in date
Date Tier 1
1/6/2006 4.22
1/13/2006 4.27
1/20/2006 4.27
1/27/2006 4.314
2/3/2006 4.314
for example, 4.22-4.27 = -0.05
View 9 Replies
View Related
Jul 30, 2007
If there is such an animal...
My employer uses a third party employee tracking system and I do back end work to massage the raw data for ad hoc reports using tables created by this third party software.
Is there a simple means to have a query compare Table A and Table B where Table A is a list of all jobs in a company - both filled and vacant - and Table B is a list of all employees in the company? The table containing jobs data has no field designating whether a job is filled or not. The only way to determine vacancies is to compare the two tables and select only those job numbers where there is no matching employee.
So, using examples from an earlier question - one that KeithG answered perfectly - let me see if I can demonstrate what I'm trying to do...
The Jobs table has two fields; JobNum and JobDesc.
The Employee table has three fields; EmpNum, EmpName, JobNum.
Here's Table A, Jobs;
100, Boss
105, Aide
200, Manager
201, Worker
202, Worker
Here's Table B, Employees;
111, Montgomery Burns, 100
112, Waylon Smithers, 105
121, Homer Simpson, 201
122, Lenny Leonard, 202
Jobnum is the link between the two tables in the query and the query's fields are;
JobNum and JobDesc
The result I need is;
200, Manager
The only vacant job.
So, how do I do a subtract query, if that's even a proper term? How do I have a result that is all of Table A that does not have a match in Table B?
Thanx!
View 2 Replies
View Related
Jan 14, 2008
I have a report based on a query where I get results sorted by month after i have chosen 'from date' and 'to date' in the beginning. I also want a set number for each month to be subtracted from the total sum, and then added to the next month (even if it is a negative number). Ex. Total in january is 100, then it is supposed to subtract 50 from that number, report the result of 50 in one own field at the end of january, then send this to february where the total sum is ex. 200, then the total sum for february is supposed to be 250, and then again a different number, like 60 is automaticly subtracted from the total sum and displayed in one field as the result 190. And so on.. Does anyone know if this is possible, and how? I am a noob, both in access and in the english language :P
View 1 Replies
View Related
Mar 12, 2007
(hard being a rookie)
On my Form, I want to have a query look at one specific field for a number (1). If the number is found then I would like to have the query do basic subtraction on two other fields. (one from each table)
What I have so far is one unbound text box with the following,
=IIf(tblDaStrategy!DaNumber=1,(tblDaStrategy!DaTar get-tblDaReport!DaActual1))
Simply put, if one field has the number one in it, then take the other two fields and subtract (ex. 100-75) to display 25.
It's not working. I keep getting the #Name?
Update: I think I got it. I went back to square one and made a master query that contains the data from both tables. Then I bound one of the forms to the query. I updated my IIF statement and poof. It seems to be working. Now, where's the Asprin and my pillow?
Update 2: Bummer, now my magical 25 is in place but now my form is locked tight. Guess I need to consider abandoning this concept and simply producing a report with the 25 on it. Unless someone out there has a better idea.
View 1 Replies
View Related
Apr 19, 2007
4/11/2007 1:01:28 AM
4/12/2007 2:02:52 AM
4/13/2007 4:21:30 AM
4/14/2007 2:22:21 AM
4/15/2007 3:34:53 AM
4/16/2007 4:02:37 AM
4/17/2007 5:03:15 AM
4/18/2007 7:17:34 AM
I need helps again
How can I subtract 7 hour from the query
Thanks
View 3 Replies
View Related
Oct 31, 2007
Hi,
Working on a query, what I have is a user will select a date on a form and hit submit.
I need the query that it runs, to pull all data -1 day from what they select.
So if they select 10/31 on the form, it needs to pull everything for 10/30 only.
I have this in my query now,
[Forms]![frm_change_report]![txt_Date]
Which pulls the data for the date they selected, but not sure how to subtract a day.
View 2 Replies
View Related
Mar 7, 2008
I'm sure this is simple but my brain is mushy this morning!
I have two datetime fields ADMISSION and DISCHARGE with values such as 03/02/2008 15:00. How do I convert these to dates only? I don't want to just *format* them as dates, which I can do. In this example I would want to convert that date to 03/02/2008 (or 03/02/2008 00:00)
It's an idiosyncrasy of the way the NHS calculates hospital length of stay. Our previous IT system had dates and times in separate fields so I could just ignore the time field and work out length of stay based on dates only. However, our new system returns a combined datetime.
Patient A 03/02/2008 00:15 to 03/02/2008 23:45 = 0 days
but
Patient B 03/02/2008 23:45 to 04/02/2008 00:15 = 1 day
Basically, you count a day if there's a date change, even if that was only half an hour (or even a few minutes) either side of midnight, but you DON'T count a day if there was no date change, even if that was almost 24 hours.
So formatting them as dd/mm/yyyy wont work ,as I will still have partial days when I subtract one from the other and INT([DISCHARGE]-[ADMISSION]) wont always work either as it would calculate 0 for patient B.
Help!
View 2 Replies
View Related
Sep 10, 2004
I have a table that has two fields; odometer reading and reading date. I want to able input the reading dates along with the odometer readings. Then I want my query to calculate the milage difference between each date.
Example:
DATE READING DIFFERENCE
9/1/04 35000
10/1/04 40000 5000
11/1/04 42000 2000
And so on.............
Thanks in Advance - John
View 1 Replies
View Related
Mar 29, 2013
I having a problem with Access
I have one row in table, for example:
km_counter
18000
18100
18300
18800
and when I run a query, I want to get:
km_counter km_diff
18000
18100_____ 100
18300_____ 200
18800_____ 500
is it possible to do that?
View 3 Replies
View Related
Mar 6, 2014
I have two date fields. I want to subtract them to determine the number of days elapsed. The dates are in the following format: Dateserial (Year, Month, Day). When I subtract them I get 7670 as the result when the number should be 365 if they are a year apart. How can I subtract the dates in a query?
View 3 Replies
View Related
Jul 11, 2012
In my database I have a list of organizations with a certain goal. If that organization can not hit that goal we have to "reallocate" the left over goal to another organization. As it stands now I have the following fields, Goal (which should stay stagnant), change (to either subtract from one organization and add to another) and New. What I would like to do is have a way to have a way to calculate if there is a change to maybe have a drop drown that when the change is subtracted I can add that to "new" of another organization.
View 3 Replies
View Related
Jul 22, 2014
I have two calculated columns in my query for example... table.num1 - table.num2 as "Col1" and table.num1 - table.num3 as "Col2"
I then want another column equal to:
Col1 - Col2
I know that I could say:
(table.num1 - table.num2) - (table.num1 - table.num3)
but I am wondering if there is an easy way to just take two calculated columns of the query to use in the calculation of another column.
doing something like:
Col3: Col1 - Col2
doesnt work because it doesnt see Col1 and Col2 within the tables.
View 7 Replies
View Related
Feb 22, 2014
i want to substract value in combobox, but the source of the other combobox is in other table then Form query shows. How can i do that?
View 3 Replies
View Related
Jul 23, 2014
ACCESS 2007
I've got a table in which some records are associated with a number (numeric field): 691, 692, 693 etc. My parameter query asks for the number I'm looking for (parameter) and should return all records associated with that number or with that number minus one.
Something like this:
enter parameter
find records
in which number = parameter
OR
in which number = (parameter - 1)
How can I do that?
View 4 Replies
View Related
Jul 14, 2014
I have a table contains
1. full name
2. email
3. date
I want to make a query that will contain
1. full name
2. email
3. date1
4. date2
The date2 will be date1 + 90 days
So if the result is a sunday i want to add one day or subtract one day automatically...
View 7 Replies
View Related
Mar 25, 2015
My [datefield1] is formatted as dd/mm/yyyy
I wish to create a query that produces a return of the previous month and year. i.e.
25/03/2015 (though a query formula) becomes Feb-15
01/01/2000 would return DEC-99
etc
This way I can then link all of my February data (formatted "mmm-yy" to my [datefield1]
I have tried subtracting day and formatting to months and subtracting then the value of a month but it all becomes too complicated because of the different days in the months and Jan to Dec and year as well.
View 2 Replies
View Related
Apr 21, 2012
I got a form with a field called [copies on hand] so i made a command button and when i click the button, i want the value in the field [copies on hand] to be subtracted by one.....
The code i have thats not working is
Private Sub Command 25_Click()
If [copies_on_hand] >0 Then [copies_on_hand] = ([copies_on_hand]-1)
End Sub
View 9 Replies
View Related