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

connect to ADP from a MDB

Status
Not open for further replies.

brau

Programmer
Feb 15, 2001
31
0
0
US
I want to be able to connect to a ADP db with SQL table from an MDB. I have to create a recordset from the sql table and put the selected records into a mdb table. I've been using DAO in the mdb. I have the following code to show you what I have tried.
Also, there are some tables I need to grab all the data, so can I do this with fewer lines of code like using a docmd line?

Thanks, Bob

Private Sub cmdImportTables_Click()
Dim sqlstring As String
'Dim rsCCC As Recordset
Dim rsCCCLocal As Recordset
sqlstring = "SELECT CertifiedClassConstruction.* FROM CertifiedClassConstruction"
rsCCC.Open sqlstring, strcnn, adOpenStatic, adLockReadOnly
'Set dbProject = "Provider=sqloledb; Data Source=SQL_DEV;Initial Catalog=ForrestDevelopment;User Id=sa"
'Set rsCCC = dbProject.OpenRecordset("select CertifiedClassConstruction.* from CertifiedClassConstruction", dbOpenStatic)
If Not rsCCC.EOF Then
rsCCC.MoveFirst
End If
While Not rsCCC.EOF
Set dbCurrent = CurrentDb()
Set rsCCCLocal = dbCurrent.OpenRecordset("SELECT CertifiedClassConstruction.* FROM CertifiedClassConstruction", dbOpenDynaset)
rsCCCLocal.AddNew
rsCCCLocal!CertifiedClass = rsCCC!CertifiedClass
rsCCCLocal!Description = rsCCC!Description
rsCCCLocal.Update
rsCCC.MoveNext
rsCCCLocal.Close
Set rsCCCLocal = Nothing
Wend
rsCCC.Close
Set rsCCC = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top