Ms Access Error 2522
Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Page 1 of 2 1 2 > Thread Tools Rate Thread Display Modes 09-26-2011, 02:09 AM #1 Eavie Newly Registered User Join Date: Aug 2011 Posts: 15 Thanks: 1 Thanked 0 Times in 0 Posts Run Time Error 2522 Hi all, I have created a database that imports mulitple spreadsheets as needed. An Import button on my form brings up another form that lists the Excel files that I can import. It works for my past databases but when I click Import and it brings up my second form it says 'Run Time Error 2522- The action or method requires a File Name argument' It is debugging to the line highlighted in purple; Quote: Private Sub cmdRunImport_Click() On Error GoTo errHandler DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "temporary_data", pubPath(1) & lstExcelFiles.Value, False, pubRange(1) appImport DoCmd.OpenForm "frmSubmitKH08", acNormal DoCmd.Close acForm, "frmImportKH08" errHandler: If Err.Number > 0 Then If Err.Number = 3011 Then MsgBox "The Spreadsheet " & lstExcelFiles.Value & " is not in the format required for import" ElseIf Err.Number = 3274 Then MsgBox "The Workbook " & lstExcelFiles.Value & " is protected. Unprotect the Workbook for Import." Else MsgBox Err.Number & vbCrLf & Err.Description End If End If End Sub Basically I need to know if this can be fixed? I've looked up multiple sites about this error and they mention things about your register etc. but I don't have access on this computer to check my registry. Can this be fixed in any simpler way? Many Thanks, Eavie Eavie View Public Profile Find More Posts by Eavie 09-26-2011, 02:19 AM #2 vbaInet AWF VIP Join Date: Jan 2010 Location: U.K. Posts: 26,373 Thanks: 0 Thanked 2,403 Times in 2,372 Posts Re: Run Time Error 2522 Run the code again and do a Msgbox on these two variables to see what comes up: lstExcelFiles.Value pubRange(1) vbaInet View Public Profile Find More Posts by vbaInet 09-26-2011, 02:31 AM #3 gemma-the-husky Super Moderator Join Date: Sep 2006 Location: UK Posts: 13,140 Thanks: 50 Thanked 885 Times in 857 Posts Re: Run Time Error 2522 if you have used it before, it should be OK, but the pubrange
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > Run-Time error '2522' Want to Advertise Here? Solved Run-Time error '2522' Posted on 2011-07-01 MS Access 1 Verified Solution 1 http://www.access-programmers.co.uk/forums/showthread.php?t=216005 Comment 1,194 Views Last Modified: 2012-05-11 I have created some VBA coe that was working fine but for some reason it now gives me an error. Run-Time error '2522' The action or method requires a File Name argument. This code used to usccessfully imports a .csv file into an Access 2007 database table. Am I losing the plot https://www.experts-exchange.com/questions/27159501/Run-Time-error-'2522'.html or is there now an error with the code? I have enclosed the section of the code I refer to and the headers for the table I am importing. Sadly I am unable to share the data. Code: Set fDialog = Application.FileDialog(3) With fDialog ' set the default folder to open .InitialFileName = "c:\temp" ' set the title of the dialog box. ' .Title = "Please select the People database delta file" ' add our own filter' .filters.Clear .filters.Add "csv Files", "*.csv" .filters.Add "All Files", "*.*" ' show the dialog box. If .Show = True Then ' flag to state that the first row of the worksheet contains headers blnHasFieldNames = True 'Clear the data out of existing tables DoCmd.SetWarnings False ' Path to the Excel file strPath = .selecteditems.Item(1) 'Returnvalue 'Stop Access warnings impacting the code DoCmd.SetWarnings False Forums Microsoft Access TransferSpreadsheet Function Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 13 TransferSpreadsheet FunctionThis is a discussion on TransferSpreadsheet http://www.mrexcel.com/forum/microsoft-access/157432-transferspreadsheet-function.html Function within the Microsoft Access forums, part of the Question Forums category; Help. I am not a particularly sophisticated Access person but have a basic understanding of Macros and have a slight ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid ms access Mode Switch to Threaded Mode Aug 16th, 2005,07:00 AM #1 Carl1 New Member Join Date Aug 2005 Location UK Posts 7 TransferSpreadsheet Function Help. I am not a particularly sophisticated Access person but have a basic understanding of Macros and have a slight problem with a Macro within Access. I am trying to Import data (Will always be in same field layout - but ms access error in Excel) into an existing table (With Same Field Format - But in Access) and append this data to the table. I have had some success using the TransferSpreadsheet function doing this but as I use Macros I have to set-up at the start the filename for the Excel File. Is there a way that I can change this filename, so it looks at a different file each time (Will always be the same format)? Ideally I would like to be able to just run the macro - and browse/search and dble click the actual file I want appending at that time. Hope someone can help Carl Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Aug 16th, 2005,08:06 AM #2 Norie Board Regular Join Date Apr 2004 Location Stirling Posts 70,071 Carl Is there a pattern to how the filename will change? eg according to the date You could use an inputbox to enter the name of the file. But I don't know if you can use that via a macro, you might have to convert the macro to actual VBA code. Share