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

Export/Import data from one Access database to another

Status
Not open for further replies.

ccheng

Technical User
Oct 25, 2004
3
US
Hi,

I'm wish to export a table using the same export function that exists already in the Access program. Below is the code that defines the export function. How should I modify it so that it will also export another table name "td03_clients"?

Code:
Public Sub ExportData(repertoireExport As String, NomFichierExport As String)

On Error GoTo Err_Sub

    Dim stSql As String
    Dim repertoire, fichier
    Dim nomBaseExport As String
        
    'contrat
    If VerifObjet([b]glNomTableContratIo[/b]) = True Then
        DoCmd.DeleteObject acTable, glNomTableContratIo
    End If
    stSql = "SELECT tc01_Contrats.* INTO " & glNomTableContratIo & " FROM tc01_Contrats WHERE ((([tc01_Contrats].[Top_Export])= Yes));"
    ExecuteSql (stSql)

From the code above, the part in bold refers another existing module(Dim glNomTableContratIo As String). Would I need to include a new global variable like "Dim glNomTableClientIo as String" too?

Thank you in advance!
 
The simple answer to your last question is yes. You can create a variable to replace in the tc01_Contrats to make it more dynamic the way you did with your other variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top