HamotIntern
MIS
I have a piece of code that is associated to a button on a simple form in Access. When I press it, it looks at a table for which tables to import from an AllBase database and then imports it/them. DTS’s Import Function does not work in this application because it doesn’t work with the ODBC Driver we are using. However, Access’ TransferDatabase function does work and works well. Now, we would like to automate the whole process of importing the tables, scrubbing them, inserting the data into existing tables, and then generating a daily report for each patient in the ICU. Below is the code, is there a way to use it in the DTS or what would be an equivalent method to do this?
Dim rst As ADODB.Recordset
Dim strCriteria As String
Set rst = New ADODB.Recordset
strCriteria = "Import = True"
With rst
.Open "bxj_Import", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
.Find strCriteria
Do While Not .EOF
Label3.Caption = rst!TblName
DoCmd.TransferDatabase acImport, "ODBC", "ODBC;DSN=CareVue;UID=xyz;PWD=xyz", acTable, rst!TblName, rst!NewTblName
.Find strCriteria, 1
Loop
End With
rst.Close
Set rst = Nothing
An important note would be that this is from an adp file that is attached to the SQL server.
Dim rst As ADODB.Recordset
Dim strCriteria As String
Set rst = New ADODB.Recordset
strCriteria = "Import = True"
With rst
.Open "bxj_Import", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
.Find strCriteria
Do While Not .EOF
Label3.Caption = rst!TblName
DoCmd.TransferDatabase acImport, "ODBC", "ODBC;DSN=CareVue;UID=xyz;PWD=xyz", acTable, rst!TblName, rst!NewTblName
.Find strCriteria, 1
Loop
End With
rst.Close
Set rst = Nothing
An important note would be that this is from an adp file that is attached to the SQL server.