Hello,
I have a database that has about 60 queries in it. A new database will be created each month. Using a command button, I would like to write code to import all of the queries from the previous months database into the current months database for the user. The code I have written so far will prompt the user for the current month, based on their answer I have several variables setup with the directory and name of the database.
Is there a way to use transferdatabase with wildcards in order pickup ALL queries from another database?
Here's the code that I have so far:
CURRENTMONTHNUM = InputBox("Please enter Current Month number (ex: if month is January enter '01) :", "Current Month", "##")
Select Case CURRENTMONTHNUM
Case Is = "06"
CURRENTMONTH = "June"
prevMonth = "X:\Month\May\May.mdb"
Directory = "X:\Save\"
NewMonth = "X:\NewMonth\June\"
TextImport = "May.txt"
DoCmd.TransferText acImportDelim, "Activity Import Specification", "New Activity", Directory & TextImport
DoCmd.TransferDatabase acImport, "Microsoft Access", prevMonth, acQuery, 01query, 01query, False
DoCmd.TransferDatabase acImport, "Microsoft Access", prevMonth, acQuery, 02query, 02query , False
----- I would like to use a wildcard for the source and destination for the query so that it will pickup ALL queries so I will not have to write 60 DoCmd lines. - Does anyone know if there is a way to make this work?
Thanks,
EMMIE
I have a database that has about 60 queries in it. A new database will be created each month. Using a command button, I would like to write code to import all of the queries from the previous months database into the current months database for the user. The code I have written so far will prompt the user for the current month, based on their answer I have several variables setup with the directory and name of the database.
Is there a way to use transferdatabase with wildcards in order pickup ALL queries from another database?
Here's the code that I have so far:
CURRENTMONTHNUM = InputBox("Please enter Current Month number (ex: if month is January enter '01) :", "Current Month", "##")
Select Case CURRENTMONTHNUM
Case Is = "06"
CURRENTMONTH = "June"
prevMonth = "X:\Month\May\May.mdb"
Directory = "X:\Save\"
NewMonth = "X:\NewMonth\June\"
TextImport = "May.txt"
DoCmd.TransferText acImportDelim, "Activity Import Specification", "New Activity", Directory & TextImport
DoCmd.TransferDatabase acImport, "Microsoft Access", prevMonth, acQuery, 01query, 01query, False
DoCmd.TransferDatabase acImport, "Microsoft Access", prevMonth, acQuery, 02query, 02query , False
----- I would like to use a wildcard for the source and destination for the query so that it will pickup ALL queries so I will not have to write 60 DoCmd lines. - Does anyone know if there is a way to make this work?
Thanks,
EMMIE