Runtime error 3011 Access database engine could not find object mobile.txt (1 Viewer)

tekniculwiz

New member
Local time
Yesterday, 23:53
Joined
May 31, 2012
Messages
3
Debug identified code as DoCmd in following:
Private Sub cmdMobileExport_Click()
DoCmd.TransferText acExportDelim, "Mobile_Export", "qryMobile", "R:\FltMaint\Mobile.txt"
End Sub

Prior to executing code the Mobile.txt file existed in path reflected in code line DoCmd which happens to be on a network share mapped to local networked computer and client to same Windows domain. When tried from a local C drive the same results occur, that is the mobile.txt file exists in folder before executing code, but appears to be deleted before code responsible for checking existence of file and writing to the text file.

I cannot figure out how or why the text file is mysteriously deleted at code execution time. There is no other code executed before the sample above.

I would appreciate any suggestions or insights.
 

ypma

Registered User.
Local time
Today, 06:53
Joined
Apr 13, 2012
Messages
643
I Cannot find fault with your docmd and cannot see why it would delete the mobile.txt my assumpion is that is does not like the sub folder fltmaint.The following script shoud place the Mobiletxt file into the drive where your db is located. Its long winded compare to yours but may be helpful in debugging ' I have not included the FltMain sub folder in attempt to eliminate it as the cause.

Private Sub Command661_Click()
On Error GoTo ProcError
Dim strPath As String
strPath = CurrentProject.Path
DoCmd.TransferText TransferType:=acExportDelim, _
SpecificationName:="Mobile_Export", _
TableName:="qryMobile", _
FileName:=strPath & "\Mobiletxt", _
HasFieldNames:=0
MsgBox "The selected Mobile Phone numbers have been exported " _
& "to the file MobileTxt" & vbCrLf _
& "in the folder:" & vbCrLf & strPath, vbInformation, _
"Export Complete..."
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in cmdExportTabDelim_Click event procedure..."
Resume ExitProc
'Specifications are stored in System tables (MSysIMEXSpecs, MSysIMEXColumns) but it is probably easier to choose to import manually, choose Advanced and then choose Specs.

End Sub
 

tekniculwiz

New member
Local time
Yesterday, 23:53
Joined
May 31, 2012
Messages
3
ypma, I appreciate your reply, suggestion and effort in code. The mobile.txt is located in same folder and drive as db. I have tried different drives, different folders and paths, even tried root of different drives each time getting same result, that is mobile.txt is deleted and then get error indicating that mobile.txt cannot be found. This is so weird. I'm using Access 2010, but I wonder if I tried Access 2007 if maybe there's some issue in Access 2010 contributing to this problem. I might as well try 2007 and see if that makes any difference.
 

ypma

Registered User.
Local time
Today, 06:53
Joined
Apr 13, 2012
Messages
643
Thank you for keeping me up todate, my code was based on A2003 so that could be a reason I could not find an error. I assume you can export to a text file manually in A2010 if you can and have tried that, is the mobile.txt created on the selected drive?
I will attempt to create the code on my wife’s pc which has a2010, but don’t hold your breath as you seem to have tried most things that I would. Notice that simiar threads ,report Run time error 3011 if you have not checked them out it may be worth a look at some of the answers !

Another test you could try and that is; copy your data source table to a local table and link your QryMobile to that, this would bypass the net work , if that work we would know its the network that does not like the coding if not back to square one.
 
Last edited:

Rat1sully

Unhappy Forced codemonkey
Local time
Today, 06:53
Joined
May 15, 2012
Messages
44
try for the path element

Code:
currentproject.path & "\mobile.txt"

this gets around all the network mapping issues
 

trek2120

New member
Local time
Today, 02:53
Joined
Jul 3, 2012
Messages
1
I received the same error using the filename of "D:\Projects\__Duck\AbsenceTypes.txt". When I changed it to "D:\Projects\AbsenceTypes.txt", the error went away. I then created a different directory, "D:\Projects\Duck\AbsenceTypes.txt", and that worked fine. I then added a single underscore, "D:\Projects\_Duck\AbsenceTypes.txt", and that worked ok. Apparently it doesn't like double underlines in the filename.
 

troublecoder777

New member
Local time
Yesterday, 23:53
Joined
Aug 5, 2015
Messages
1
Another solve for this: You cannot have 2 periods (.) in a file being used for the import. Probably the same issue as the underscores.
 

RonLavi

New member
Local time
Yesterday, 23:53
Joined
Feb 16, 2017
Messages
3
Error is: Run-time error '3011'. The Microsoft Office Access database engine could not find the object 'export.html'. Make sure that the object exists and that you ... I'm assuming that there is a policy setting somewhere, a firewall setting, or a security flaw in Access 2007 that prevents output to a network drive.

That error is not very clear. I got the error on the following command


DoCmd.OpenReport "check", acNormal, "[checknumber]='" & Me.CheckNumber & " '"

I tried several solutions but nothing solved it...However, I solved it by editing the check report:
1. Edit the Check report
2. Look in Properties
3. Select "report" under selection type
4. Click the Data Tab
5. I emptied the box from Queries and other info
6. Ran the report again and no problems
 

Attachments

  • Properties.jpg
    Properties.jpg
    35.1 KB · Views: 260

Users who are viewing this thread

Top Bottom