Solved

Update query in MS access

Posted on 2011-03-03
3
232 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 119

Expert Comment

by:Rey Obrero
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks so much!  I think I tried everything but that.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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: …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

16 Experts available now in Live!

Get 1:1 Help Now