Update query in MS access

Posted on 2011-03-03
Last Modified: 2012-05-11
I made an access table from data in MS excel that needs to be used to update data in a sql server table.  I have the update query setup, but the data is currency, and when I run the update query, I am getting several decimal places to the right of the decimal point, and I only want two.  The data type of the sql server fields are float.  Can I convert this data that I am updating from to be able to get it into sql server as only 2 decimal places?

sql query:

UPDATE [Inventory Value] LEFT JOIN dbo_Operation1 ON ([Inventory Value].Seq = dbo_Operation1.nSequence) AND ([Inventory Value].PartID = dbo_Operation1.idPart) SET dbo_Operation1.qStdCost = [Inventory Value]![Std Cost (Calc)], dbo_Operation1.qCustomCost = [Inventory Value]![Cum Step Value]
WHERE ((([Inventory Value].PartID)=2430));

Question by:sannunzi
LVL 119

Expert Comment

by:Rey Obrero
ID: 35027801
try this

UPDATE [Inventory Value] LEFT JOIN dbo_Operation1 ON ([Inventory Value].Seq = dbo_Operation1.nSequence) AND ([Inventory Value].PartID = dbo_Operation1.idPart)
SET dbo_Operation1.qStdCost = formatnumber([Inventory Value]![Std Cost (Calc)],2), dbo_Operation1.qCustomCost = formatnumber([Inventory Value]![Cum Step Value],2)
WHERE ((([Inventory Value].PartID)=2430));

Accepted Solution

clayhopkins earned 500 total points
ID: 35032173
What about wrapping the currency values in a SQL ROUND() function:
dbo_Operation1.qCustomCost = ROUND([Inventory Value]![Cum Step Value], 2)

Open in new window


Author Closing Comment

ID: 35033021
Thanks so much!  I think I tried everything but that.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
OCT or Config.xml 2 34
ms/access hyperlink/ftp 7 35
T-SQL for SS2000 -- get position of char(13) in a long text field 11 28
Alter an update query which rounds 7 31
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now