Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Convert Sql Server Join Query To Access 1

Status
Not open for further replies.

vish6

Programmer
Aug 23, 2005
2
IN
Hi
I want to convert this sql server query in MS Access.It will work in sql server.
So plz Tell me How to write it in Access.

Update StockTable Set Outward=Outward-SM.Netweight,OutwardQty=OutwardQty-SM.Qty From Stocktable ST Join SalesVchMaterialDescCR SM on ST.Materialid=SM.Material_Name where ST.Materialid=SM.Material_Name and Transactionid=" & txtTransactionID.text & " and ST.VoucherDate=SM.VoucherDate
 
Try bracketing the field names and it looks to me like your quotes are backwards for Access, it will read "& txttransactionsID.text &" as a string literal. Leaving those quotes out should help with that portion. Also, quotes should be used in pairs. Hope that helps get you on track...



All lessons learned from the School of Hard Knocks........at least tuition is cheap.
 

Update StockTable Set Outward = nz([Outward])-nz([SM].[Netweight]), OutwardQty = nz([OutwardQty])-nz([SM].[Qty] From Stocktable As ST Inner Join SalesVchMaterialDescCR As SM on (ST.Materialid=SM.Material_Name) And (ST.VoucherDate = SM.VoucherDate) where Transactionid ='" & txtTransactionID & "'"

nz([Field]) = converts Nulls to 0
nz([Field], whatever) = converts Nulls to whatever
 
The syntax in access is:
UPDATE Table1 AS A INNER JOIN Table2 AS B ON join clause
SET ....
WHERE ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top