Hi,
In the application, my db is split from the forms. Now in my mdb which contains the interfaces, there is also a copy of the tables from the db but with only default values in them.
What I want to do is by the press of a button allow the user to export the sample tables from the application into a new mdb. I would like to allow the user to choose the name and location of this new mdb by using a common dialog box. I figured out how it all works w/o the common dialog but I need some help with the dialog box!!!!!!
Here is the code that I have used to export the sample tables into a new mdb.
Dim appAccess As Access.Application
Public Function NewData()
Dim dbs As Object
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = "C:\Documents and Settings\All Users\Desktop\NewDB.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application.9"
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
appAccess.CloseCurrentDatabase
Set appAccess = Nothing
'Exports the Sample Tables to a new db called NewDB
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleActivities", "tblActivities", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleClients", "tblClients", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleProgress", "tblProgress", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleProgressCriteria", "tblProgressCriteria", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleProjects", "tblProjects", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleRejectedTimeSheets", "tblRejectedTimeSheets", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleResAssignments", "tblResAssignments", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleResources", "tblResources", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleTimesheets", "tblTimesheets", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleTSExcelCopy", "tblTSExcelCopy", False
End Sub
Can anyone PLEASE help pme with this!!
Thanx alot,
Legs
In the application, my db is split from the forms. Now in my mdb which contains the interfaces, there is also a copy of the tables from the db but with only default values in them.
What I want to do is by the press of a button allow the user to export the sample tables from the application into a new mdb. I would like to allow the user to choose the name and location of this new mdb by using a common dialog box. I figured out how it all works w/o the common dialog but I need some help with the dialog box!!!!!!
Here is the code that I have used to export the sample tables into a new mdb.
Dim appAccess As Access.Application
Public Function NewData()
Dim dbs As Object
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = "C:\Documents and Settings\All Users\Desktop\NewDB.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application.9"
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
appAccess.CloseCurrentDatabase
Set appAccess = Nothing
'Exports the Sample Tables to a new db called NewDB
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleActivities", "tblActivities", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleClients", "tblClients", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleProgress", "tblProgress", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleProgressCriteria", "tblProgressCriteria", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleProjects", "tblProjects", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleRejectedTimeSheets", "tblRejectedTimeSheets", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleResAssignments", "tblResAssignments", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleResources", "tblResources", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleTimesheets", "tblTimesheets", False
DoCmd.TransferDatabase acExport, "Microsoft Access", strDB, acTable, "tblSampleTSExcelCopy", "tblTSExcelCopy", False
End Sub
Can anyone PLEASE help pme with this!!
Thanx alot,
Legs