Solved

From Access to MSSQLSERVER

Posted on 1998-05-29
6
184 Views
Last Modified: 2010-05-03
Using VB5, MSSQL server 6,5,   DAO
I have mdb database and linked with server exsisting empty table(dbo_cheque)I wanted to move table contents to MSSQL server
DAO
sql = "INSERT INTO dbo_cheque SELECT * FROM chequeproper;"
 db.Execute sql

I am getting error message 3070 : MS Jet does not recognize "aaaa"(my mdb fieldname) as a valid field name
I tried to use several field names over there, result the same.
Any help appreciated
0
Comment
Question by:mativare
6 Comments
 
LVL 9

Expert Comment

by:cymbolic
ID: 1462034
Your syntax needs to be:

Insert Into dbo_cheque (field1,field2,field3...) select fromfld1,fromfld2,fromfld3... from fromtabl [optional where clause]

You need to enumerate the fields inserted.  You need to have rights on the server.  You need to include all necessary key fields, foreign key constraints, not null fields etc to make it happen.
0
 
LVL 2

Expert Comment

by:marti
ID: 1462035
Be sure to have the same number and type of the fields in both dbo_cheque and chequeproper. They have to be at the same order as well for your Qry to be executed correctly.
0
 
LVL 1

Expert Comment

by:JayMerritt
ID: 1462036
What you really need is the Access to SQL Upsizing tool from Microsoft.  
0
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.

 
LVL 2

Expert Comment

by:seahpc
ID: 1462037
Another way is to physically go to access and export the tables to MSSQL .
0
 
LVL 1

Author Comment

by:mativare
ID: 1462038
Ineresting
But I cannot use Upsizer in this case, because I insert data in run time, it means every time client enters row data to excel spreadsheet(linked to Access), it inserts row SQLserver too(linked via Access)
0
 

Accepted Solution

by:
eyaltil earned 50 total points
ID: 1462039
i think the problem is that the db connection cannot connect to two defrent databases in one time.
i think you shoud handle to database connections, do select in the first and do insert for the recordset u got in the second


0

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

910 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

22 Experts available now in Live!

Get 1:1 Help Now