Dear All,
I'm transfering data from one Access Database to another database using TransferDatabase method using below code:
Both the databases are password protected.
Above code is working fine. Only issue is I want to import only selected data e.g. last 12 months data only instead of full set of data. Currently I'm importing full set of data and after that I'm deleting the unwanted data, which is not efficient. Because original table contains 4 years data and approx 500K records. For current year I have only 100K records.
Is there any option in the TransferDatabase method which enables to import selected data? I want import all the records before certain date or between date range e.g. WHERE Right([BookDate], 4) >= Year(Now) - 1
Thanks for the help in advance.
I'm transfering data from one Access Database to another database using TransferDatabase method using below code:
Code:
[COLOR=black][FONT=Verdana] Set oDB = Application.DBEngine.OpenDatabase(strNNASourceDatabasePathNName, False, False)[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] Set objApp = New Access.Application[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] objApp.OpenCurrentDatabase strNNASourceDatabasePathNName, False[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] 'Export the needed tables and queries[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] 'Parameters[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] objApp.DoCmd.TransferDatabase Access.AcDataTransferType.acExport, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] "Microsoft Access", _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] strNNADestDatabasePathNName, _[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Access.AcObjectType.acTable, "NNA data", "tbl_NNA"[/COLOR][/FONT]
Both the databases are password protected.
Above code is working fine. Only issue is I want to import only selected data e.g. last 12 months data only instead of full set of data. Currently I'm importing full set of data and after that I'm deleting the unwanted data, which is not efficient. Because original table contains 4 years data and approx 500K records. For current year I have only 100K records.
Is there any option in the TransferDatabase method which enables to import selected data? I want import all the records before certain date or between date range e.g. WHERE Right([BookDate], 4) >= Year(Now) - 1
Thanks for the help in advance.
Last edited: