D
Dataman
I have a query in access 2003 containing new patient records that needs to
be inserted into a SQL server 2005 table. The code below is run from the
Access database. I do NOT want to use linked tables or pass thriugh queries.
ImportData contains the connect string. The Access front end will reside on
the local computer NOT hosting the SQL server.
The qryUniqueNewPatients query is on the access database side. The FROM
clause is looking for something from the SQL server side. I need it to look
at the qryUniqueNewPatients query on the Access side.
This has me stuck. Any help is appreciated.
============================================
Set cnn = New ADODB.Connection
cnn.Open ImportData
strSQL = "INSERT INTO dbo.tblPatients (PFirstName, PLastName,
MedicalRecNumber,DOB,MRSNID,EmployeeID) "
strSQL = strSQL & "SELECT PFirstName, PLastName,
MedicalRecNumber,DOB,MRSNID,EmployeeID "
strSQL = strSQL & "FROM qryUniqueNewPatients"
cnn.Execute strSQL
==============================================
Kurt
be inserted into a SQL server 2005 table. The code below is run from the
Access database. I do NOT want to use linked tables or pass thriugh queries.
ImportData contains the connect string. The Access front end will reside on
the local computer NOT hosting the SQL server.
The qryUniqueNewPatients query is on the access database side. The FROM
clause is looking for something from the SQL server side. I need it to look
at the qryUniqueNewPatients query on the Access side.
This has me stuck. Any help is appreciated.
============================================
Set cnn = New ADODB.Connection
cnn.Open ImportData
strSQL = "INSERT INTO dbo.tblPatients (PFirstName, PLastName,
MedicalRecNumber,DOB,MRSNID,EmployeeID) "
strSQL = strSQL & "SELECT PFirstName, PLastName,
MedicalRecNumber,DOB,MRSNID,EmployeeID "
strSQL = strSQL & "FROM qryUniqueNewPatients"
cnn.Execute strSQL
==============================================
Kurt