Solved

Update query in MS access

Posted on 2011-03-03
3
235 Views
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));


0
Comment
Question by:sannunzi
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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));
0
 
LVL 2

Accepted Solution

by:
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

0
 

Author Closing Comment

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

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

This article will show you how to use shortcut menus in the Access run-time environment.
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

785 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