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 Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert records to SQL table using MS Access (VBA)

Status
Not open for further replies.

malibu65k

Programmer
Sep 27, 2004
131
US
Is it possible to Insert records to SQL table using MS Access (VBA)? Contractual issues won't allow me to fix anything on the SQL server but I have to insert records into some SQL tables but the records that I need to insert into the SQL tables are in MS Access tables. The MS Access application is linked to the tables and I can open and view the data and run queries against them. If it's possible, how do I insert records from the tables in MS Access into the SQL tables.

Thanks in advance!
 
Assuming that the SQL server tables are linked into Access, the usual way is

Code:
INSERT INTO mySQLServerTable (Fld1, Fld2, Fld3, ...)

SELECT FldA, FldB, FldC, ...
From myAccessTable
WHERE [blue]... Some logical Conditions ...[/blue]

This assumes of course that you are authorized to modify the SQL Server tables in question.
 
I'm getting a sqlstate 08004, sql error 4060, a logon/connection error. I'm guessing I don't have write access?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top