473,387 Members | 2,436 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.

Update Query not updating records

294 256MB
I am really clueless as to why my query isn't working. (Don't take that as a confession of not doing research and Googling) Its' purpose is to calculate remaining units someone is allowed to keep - depending on when they were given and when they are separating. (The conditions are attempted to be replicated in the SQL)


Does anyone see something that would be an immediate red flag?

Expand|Select|Wrap|Line Numbers
  1.         UPDATE AwardTbl SET AwardTbl.VestingDate = Date(), 
  2.         AwardTbl.ForfeitedUnits = IIf(CalcExactDiff([AwardTbl]![AwardDate])<1,[AwardTbl]![AwardUnits],
  3.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<2,0.8*[AwardTbl]![AwardUnits],
  4.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<3,0.6*[AwardTbl]![AwardUnits],
  5.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<4,0.4*[AwardTbl]![AwardUnits],
  6.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<5,0.2*[AwardTbl]![AwardUnits],0))))), 
  7.         AwardTbl.SpecialVestedUnits = IIf(CalcExactDiff([AwardTbl]![AwardDate],[AssociateTbl]![SeparationDate])<1,0,
  8.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[AssociateTbl]![SeparationDate])<2,0.2*[AwardTbl]![AwardUnits],
  9.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[AssociateTbl]![SeparationDate])<3,0.4*[AwardTbl]![AwardUnits],
  10.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[AssociateTbl]![SeparationDate])<4,0.6*[AwardTbl]![AwardUnits],
  11.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[AssociateTbl]![SeparationDate])<5,0.8*[AwardTbl]![AwardUnits],[AwardTbl]![AwardUnits]))))), AwardTbl.ForfeitDate = Date();
The 'CalcExactDiff' is simply finding the exact difference of 2 dates and is a function in the VBA code.
Jan 16 '14 #1
1 1238
mcupito
294 256MB
I figured it out. There were missing fields that I simply overlooked.

Expand|Select|Wrap|Line Numbers
  1.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[Forms]![AstProfileAwardFrm]![SepDateTxt])<1,0,
  2.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[Forms]![AstProfileAwardFrm]![SepDateTxt])<2,0.2*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]),
  3.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[Forms]![AstProfileAwardFrm]![SepDateTxt])<3,0.4*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]),
  4.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[Forms]![AstProfileAwardFrm]![SepDateTxt])<4,0.6*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]),
  5.         IIf(CalcExactDiff([AwardTbl]![AwardDate],[Forms]![AstProfileAwardFrm]![SepDateTxt])<5,0.8*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]),
  6.         [AwardTbl]![AwardUnits]-)))))
And here's the other calculation:
Expand|Select|Wrap|Line Numbers
  1.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<1,[AwardTbl]![AwardUnits],
  2.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<2,(0.8*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]-[AwardTbl]![PaidOutUnits]))+[AwardTbl]![ForfeitedUnits],
  3.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<3,(0.6*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]-[AwardTbl]![PaidOutUnits]))+[AwardTbl]![ForfeitedUnits],
  4.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<4,(0.4*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]-[AwardTbl]![PaidOutUnits]))+[AwardTbl]![ForfeitedUnits],
  5.         IIf(CalcExactDiff([AwardTbl]![AwardDate])<5,(0.2*([AwardTbl]![AwardUnits]-[AwardTbl]![ForfeitedUnits]-[AwardTbl]![PaidOutUnits]))+[AwardTbl]![ForfeitedUnits],
  6.         [AwardTbl]![ForfeitedUnits])))))
Jan 17 '14 #2

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

Similar topics

2
by: JMCN | last post by:
hi i need some advice on whether if it would be better to use an append query or an update query. here is the situation, i have linked another database table to my current database. then i...
1
by: jlkass | last post by:
Hello - I am trying to execute an update query, updating 4 fields in one table. Is there a way that I can enter the first value for each field, and then serialize the first field for a given...
1
by: G Gerard | last post by:
Hello I am trying to update a table (TableB) using records from a second table (TableA)
3
by: hharriel | last post by:
Hi All, I have created an update query related to high school course information (name of course; credit hour; course description, etc.) I am updating a master course information table. I am...
6
by: Dixie | last post by:
I have asked this question before, but I could not get the suggested solution work. So I will give more details this time. I have an append query that adds several hundred records to a table...
2
by: sbowman | last post by:
I ran the following update query in Sql Server 8.0: update _SMDBA_._CUSTOMER_ set _SMDBA_._CUSTOMER_.client = dbo.results.adid from _SMDBA_._CUSTOMER_, dbo.results where...
1
by: M3lancholy | last post by:
I've created a database in Microsoft Access 2003, Windows XP. It updates based on: a date range, and various other field matches. It takes this data from a form. What I'm confused about is that...
2
by: najimou | last post by:
Hi I have a subform where the user make changes to several filtered records in view. when clicking the updating button, I run the update query to perform some calculations and update the table...
11
by: gnortenjones | last post by:
I have a linked table (to an oracle db), and I am trying to run a simple update query against it to change some data, but I am getting the following error: "...didn't update 0 fields due to a type...
6
JKing
by: JKing | last post by:
I'm using an update query to update a single field in a table. Table1 is part of my normalized table structure. Table2 is used solely as an import table for raw data which I sort and summarize...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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,...
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.