Error 3343 Unrecognized Database Format -- After Running Saved Import from VBA

CPGDeveloper

Board Regular
Joined
Oct 8, 2008
Messages
174
I have an Access application that has a saved import of an excel spreadsheet which I run through code --

DoCmd.RunSavedImportExport ("SavedSpec")

Through a loop, I actually change the XML of this saved specification, and run it several times -- each time changing the name of the file I'm importing and the name of the table it's importing to.

Sometimes it works, sometimes it doesn't. When it doesn't work, I get Error 3343, Unrecognized Database Format -- and I get it on the DoCmd.RunSavedImportExport line. At this point the database becomes unstable, and automatically makes a backup of itself.

I've triple-checked to make sure that the spreadsheets that are being imported are the correct name and location, etc.

Our network is notoriously slow -- which might explain why it works sometimes and doesn't other times -- but could it be something else I'm missing?

Any thoughts or ideas would be greatly appreciated. Thanks in advance for your time.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Through a loop, I actually change the XML of this saved specification, and run it several times -- each time changing the name of the file I'm importing and the name of the table it's importing to.

I haven't seen this before. How is it done?

For what it's worth I have never had trouble with import specs ... until this year ... sigh.
 
Upvote 0
Here's a snippet of my code...with comments. I find that if I step through the code slowly it *usually* works. But if I just run it, it usually does not. It's strangely hit or miss --

Do While n < 4

'Define Path -- 'strXML' is the XML definition of the Saved Import Spec. This is identifying where in the code is the path and file name of the spreadsheet I'm 'importing. I'm then replacing that part of the XML code with the new file name contained in the variable 'pfilenm'
s = InStr(strXML, "\\fsjq")
e = InStr(strXML, ".xlsm") + 5
oldFile = Mid(strXML, s, e - s)
strXMLNew = Replace(strXML, oldFile, pfilenm)
Access.CurrentProject.ImportExportSpecifications(0).XML = strXMLNew

'Define Table Name -- I'm doing the same process above, but this time for the Table the spreadsheet is importing to
s = InStr(strXMLNew, "tData")
e = InStr(strXMLNew, "Range") - 2
oldTab = Mid(strXMLNew, s, e - s)
datax = "tData" & n
strXMLNew2 = Replace(strXMLNew, oldTab, datax)
Access.CurrentProject.ImportExportSpecifications(0).XML = strXMLNew2

'Import Data - The RunSavedmportExport line will often intermittently produce the 3343 Error
UpdateStatus ("Loading Month " & n + 1)
DoCmd.RunSavedImportExport "tDataSpec"
 
Upvote 0
Is this Access 2013?
What are the names of the things you are importing - i.e., what are you changing in the xml?
Have you looked at the xml to inspect it for problems when the error occurs?

Note that if you post the xml here enclosed in our PHP tags (available as a button to click if you are not using the quick editor but are in the "Go Advanced" edit mode), then we can view it on the website without the html rendering going haywire.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top