Results 1 to 4 of 4
Thread: Access
Hybrid View
-
15th June 2006 13:01 #1
Access
, Access. , 100 , . Vbasic, , . ,

. () SQL -...Last edited by ; 15th June 2006 at 13:04.
, , , ,
-
15th June 2006 15:25 #2
Linked ble
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb()
For Each tdf In dbs.TableDefs
If Then
tdf.Connect = m_strConnect
tdf.RefreshLink
Docmd.Query "Query1"
End If
Next
DAO
Private Sub CreateLinkedTable(cnSource As ADODB.Connection, _
cnDestination As ADODB.Connection, _
sSourceTable As String)
Dim oCat As ADOX.Catalog
Dim oTab As ADOX.Table
Set oTab = New ADOX.Table
Set oCat = New ADOX.Catalog
Set oCat.ActiveConnection = cnDestination
With oTab
.ParentCatalog = oCat
.Name = "lnk" & sSourceTable
.Properties("Jet OLEDB:Remote Table Name").Value _
= sSourceTable
.Properties("Jet OLEDB:Link DataSource").Value _
= cnSource.Properties("Data Source Name")
.Properties("Jet OLEDB:Create Link").Value = True
End With
oCat.Tables.Append oTab
End Sub
Set adoRS = adoConn.OpenSchema(adSchemaTables)
' Where adoRS is a Recordset object and adoConn is a Connection object
Do Until adoRS.EOF
strType = adoRS.Fields("TABLE_TYPE") ' Get type of Table
If strType = "TABLE" Or strType = "VIEW" Then ' Only interested in
Tables and Views (queries)
strTable = adoRS.Fields("TABLE_NAME") ' Get Table name
If Then
CreateLinkedTable(...)
Docmd.Query "Query1"
End If ' strType = "TABLE" Or...
adoRS.MoveNext '
Get next RS from adSchemaTables Fields collection
Loop ' Until adoRS.EOF
ADOLast edited by entium; 15th June 2006 at 17:01.
EP43-DS3|E5200@3.33|ASUS EN9800GT HB /HTDI/ 512MB|2X2GB 800MHZ CL5 A-DATA|WD2500JB|NEC 4750A|BELINEA 1980S2
-
15th June 2006 15:50 #3
Private Sub cmdAssocGenerator_Click()
Dim FullFileName, Table1, Table2, Table3, Table4 As String
Table1 = "dbo_Assoc10-Demographics&Volume&CB"
Table2 = "dbo_Assoc10-Equipment"
Table3 = "dbo_Assoc10-InvoiceMast"
Table4 = "dbo_Assoc10-InvoiceMast QA"
FullFileName = "n:\Data Warehouse\Dallas\Canada Ad Hocs\" &
txtFileName.Value & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Table1,
FullFileName, Yes
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Table2,
FullFileName, Yes
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Table3,
FullFileName, Yes
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Table4,
FullFileName, Yes
MsgBox "DONE!", vbOKOnly, "Exporting Finished"
End Sub
export ExcelEP43-DS3|E5200@3.33|ASUS EN9800GT HB /HTDI/ 512MB|2X2GB 800MHZ CL5 A-DATA|WD2500JB|NEC 4750A|BELINEA 1980S2
-
15th June 2006 16:30 #4




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in