Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

From Access to SQL Server

Posted on 2000-03-23
7
Medium Priority
?
181 Views
Last Modified: 2010-05-02
I have an update statement which works in Access. Now I am moving to SQL Server and  trying to modify the statement, but so far without luck. What am I doing wrong?

Here the Access statement:

 UPDATE MyTable INNER JOIN YourTable ON MyTable.ID = YourTable.ID SET MyTable.NAME = [YourTable]![NAME], MyTable.ADDRESS = [YourTable]![ ADDRESS]

Here my new modified for SQL Server statement.

UPDATE MyTable
SET MyTable.NAME = YourTable.NAME, MyTable.ADDRESS = YourTable. ADDRESS
WHERE MyTable.ID = YourTable.ID

Thanks.
0
Comment
Question by:andr
  • 4
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
ndb earned 200 total points
ID: 2651209
Try:

UPDATE MyTable
SET MyTable.NAME = YourTable.NAME, MyTable.ADDRESS = YourTable. ADDRESS
FROM MyTable, YourTable
WHERE MyTable.ID = YourTable.ID

0
 

Author Comment

by:andr
ID: 2653425
Thank you ndb. That worked.
The only problem I have now - when I run it in the Sql server - everything is fine, but when I am trying to run from VB it gives me message "YourTable is not an object's name".
If you have an answer I will post it as a separate question(I have 30 points left at this time).
0
 
LVL 1

Expert Comment

by:ndb
ID: 2653569
Try to use:

UPDATE MyTable
SET MyTable!NAME = YourTable!NAME, MyTable!ADDRESS = YourTable!ADDRESS
FROM MyTable, YourTable
WHERE MyTable!ID = YourTable!ID





0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:andr
ID: 2653905
No, sql server doesn't recognize this syntax.
0
 
LVL 1

Expert Comment

by:ndb
ID: 2654018
What do you use in VB to connect to your database ... ODBC or OLE DB?
0
 

Author Comment

by:andr
ID: 2654508
I use OLE DB(ADO, UID = sa, no password)
0
 

Author Comment

by:andr
ID: 2654853
I found the problem - I was connected to old database. Thans for your help.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

804 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