Results 1 to 4 of 4

Thread: Access

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    's Avatar
    Join Date: Mar:2005
    Location:
    Posts: 379

    Access

    , Access. , 100 , . Vbasic, , . ,

    . () SQL -...
    Last edited by ; 15th June 2006 at 13:04.
    , , , ,

  2. #2
    Registered User entium's Avatar
    Join Date: May:2003
    Location:
    Posts: 1,426
    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
    ADO
    Last 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

  3. #3
    Registered User entium's Avatar
    Join Date: May:2003
    Location:
    Posts: 1,426
    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 Excel
    EP43-DS3|E5200@3.33|ASUS EN9800GT HB /HTDI/ 512MB|2X2GB 800MHZ CL5 A-DATA|WD2500JB|NEC 4750A|BELINEA 1980S2

  4. #4
    's Avatar
    Join Date: Mar:2005
    Location:
    Posts: 379
    . , ....
    , , , ,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |