Hello everyone. This is closely related to my prior post - which was corrected. I no have encountered a new bug.
I would like to transfer an Excel spreadsheet into an Access table using the TransferSheet Method. The caveat is that the name of the file needs to involve a variable (a date) based on an entry from a TextBox. The name of the table is tblMTMReportData. It already has column headings. The name of the Excel spreadsheets is as follows: mtm_report_asof_yyyymmdd.xls. Now the date extension "yyyymmdd" varies.
I have created a userform and on that userform is a TextBox and a Command Button. The textBox and command button are on a page called pagCMDReturnMTMPortfolio. The textbox is called txtDate. The command button is called CommandReturnMTMPortfolio.
What I would like to happen is for the user to enter a date say 20110419. After that the user presses the button and the macro(or code) retrieves the file based on the date extension. The path to the files and folders are contained in another table.
I am getting an error : object variable or with block variable not set. I am assuming the object in question is txtDate the TextBox where the user enters a date.
I tried correcting this error by adding the following snipet:
but that does not work at all and causes the computer to crash. Any suggestions: the entire code is below:
The code I have so far is below:
Bookmarks