Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-30-2007, 09:56 AM   #1
tingler0
Registered User
 
Join Date: Oct 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
tingler0 is on a distinguished road
DoCmd.TransferText runtime error

i am trying to import a CSV file into a table based on the selected date but i am getting a run-time error '2495' The action or method requires a Table Name argument. Here is my code if anyone can help.

DoCmd.TransferText , acImportDelim, Contracts, "\\Zbnawlfs002\Dept\AR-Collections\CashApplications\ContractLogReport\(Se lectDate).csv", True

tingler0 is offline   Reply With Quote
Old 10-30-2007, 04:10 PM   #2
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,460
Thanks: 51
Thanked 948 Times in 917 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
when you enter the code, the autoprompts should offer you choices etc. Without checking, I think you may be missing parameter(s)

if contracts is the name of the new table, it should be enclosed in quote marks, otherwise access looks for a variable called contracts. This may be the error
gemma-the-husky is offline   Reply With Quote
Old 10-30-2007, 04:18 PM   #3
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,811 Times in 1,573 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Quote:
DoCmd.TransferText , acImportDelim, Contracts, "\\Zbnawlfs002\Dept\AR-Collections\CashApplications\ContractLogReport\(Se lectDate).csv", True
Well, first of all, there is no comma after TransferText and before acImportDelim.

Second, as gemma mentions Contracts would then be the import specification and it would need to be in quotes. The next field is the table name, not the path. So, I think you'd better check the TransferText properties again:
Quote:
Originally Posted by Microsoft Access VBA Help File
expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)
But the help file doesn't mention not using the parentheses. So it should be:

Code:
expression.TransferText TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 10-31-2007, 05:18 AM   #4
tingler0
Registered User
 
Join Date: Oct 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
tingler0 is on a distinguished road
Quote:
Originally Posted by boblarson View Post
Well, first of all, there is no comma after TransferText and before acImportDelim.

Second, as gemma mentions Contracts would then be the import specification and it would need to be in quotes. The next field is the table name, not the path. So, I think you'd better check the TransferText properties again:


But the help file doesn't mention not using the parentheses. So it should be:

Code:
expression.TransferText TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage

Thank-you but now i am getting a Run-time error '31519' You cannot import this file.
tingler0 is offline   Reply With Quote
Old 10-31-2007, 09:50 PM   #5
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,811 Times in 1,573 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
What's your actual code now that you've fixed it? Maybe it is still slightly askew.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 11-01-2007, 03:44 AM   #6
tingler0
Registered User
 
Join Date: Oct 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
tingler0 is on a distinguished road
After play with it a little yesterday i now have a runtime error '3044' not a valid path. i have verified the location of the file and it is correct, could be that it is on a server and not my C: drive?

here is the code.
DoCmd.TransferText , acImportDelim, "Contracts", "\\Zbnawlfs002\Dept\AR-Collections\CashApplications\ContractLogReport\" & (selectdate) & ".csv", True
tingler0 is offline   Reply With Quote
Old 11-01-2007, 04:40 AM   #7
boblarson
Smeghead
 
boblarson's Avatar
 
Join Date: Jan 2001
Location: Oregon, USA
Posts: 32,068
Thanks: 97
Thanked 1,811 Times in 1,573 Posts
boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold boblarson is a splendid one to behold
Quote:
Originally Posted by tingler0 View Post
After play with it a little yesterday i now have a runtime error '3044' not a valid path. i have verified the location of the file and it is correct, could be that it is on a server and not my C: drive?

here is the code.
DoCmd.TransferText , acImportDelim, "Contracts", "\\Zbnawlfs002\Dept\AR-Collections\CashApplications\ContractLogReport\" & (selectdate) & ".csv", True
What is (selectdate) and how do you set it. That is probably the problem. First of all, you don't need the parentheses around selectdate and if you are trying to have someone enter it in as a parameter, use a form.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
boblarson is offline   Reply With Quote
Old 11-01-2007, 05:40 AM   #8
Guus2005
AWF VIP
 
Guus2005's Avatar
 
Join Date: Jun 2007
Location: The Netherlands
Posts: 2,490
Thanks: 44
Thanked 79 Times in 75 Posts
Guus2005 has a spectacular aura about Guus2005 has a spectacular aura about Guus2005 has a spectacular aura about
Like bob said earlier:
Quote:
Originally Posted by boblarson View Post
Well, first of all, there is no comma after TransferText and before acImportDelim.
so remove it.

Guus2005 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime error 429: ActiveX canít create Object webbmatt Modules & VBA 1 01-09-2007 06:18 PM
Runtime Error (3075), not sure how to fix it SD23 Modules & VBA 1 07-12-2006 02:14 PM
Weird Access Runtime Error illy2k General 1 06-15-2006 05:35 PM
Object variable or With block variable not set (RunTime Error 91) Hemish Modules & VBA 1 08-03-2005 11:33 AM
Access Runtime - Runtime error mazza Modules & VBA 3 07-13-2005 12:19 PM




All times are GMT -8. The time now is 04:52 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World