Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2005

Tip: Looking for answers? Try searching our database.

Very strange VB code error... please help.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nicholas Scarpinato - 30 Dec 2005 17:57 GMT
First of all, here is the code in question:

Function AutoImportImportFiles() As Variant
Dim strFileDateMonth
Dim strFileDateDay
Dim strFileType As String
Dim strDestinationName
strFileType = "BD"
For strFileDateMonth = "10" To "12"
For strFileDateDay = "10" To "31"
strDestinationName = "C:\Import\" & strFileType & strFileDateMonth &
strFileDateDay & "05.txt"
If Len(Dir(strDestinationName)) > 0 Then
DoCmd.TransferText acExportDelim, "BD Import Specification", "Declined
Transactions BD", strDestinationName, No
DoCmd.OpenQuery "Update Date BD"
DoCmd.OpenQuery "Append Declined BDs"
DoCmd.OpenQuery "Delete BD Table"
Else: End If
Next strFileDateDay
Next strFileDateMonth
End Function

The problem I'm getting is when the code gets to the DoCmd.TransferText
line, Access gives me the following error:

****
Run-time error '3011':

The Microsoft Jet database engine could not find the object 'BD101005#txt'.
Make sure the object exists and that you spell its name and the path name
correctly.
****

Why is it changing the ".txt" to "#txt"?
Brian - 30 Dec 2005 18:28 GMT
Not exactly sure, but try inserting this:

MsgBox strDestinationName

on the line after you build the string to see what the entire string is. See
if it is inserting more than just the one # symbol.

The # could indicate that it is interpreting a variable's type incorrectly
(e.g. as a date instead of a string), so you may need to Dim
strDestinationName As String instead of just Dim strDestinationName

Just an idea.

> First of all, here is the code in question:
>
[quoted text clipped - 31 lines]
>
> Why is it changing the ".txt" to "#txt"?
John Nurick - 30 Dec 2005 19:02 GMT
You can get this error if there's a discrepancy between the
import/export specification you're using and the structure of the table
or query you're exporting.

>First of all, here is the code in question:
>
[quoted text clipped - 31 lines]
>
>Why is it changing the ".txt" to "#txt"?

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.