Run-time error 3011

L

LJG

Hi Guys,

Am having a problem with some code, I have included this path in the code:

strSS = "C:\database\appointments\appointment_" _
& "*" & rst.Fields("User Name") & ".xls" 'the name of the
field

And fails here:
DoCmd.TransferSpreadsheet acImport, 8, "tempAppointments",
_
strTransfer, True, ""

Yet when I run this code I get an error message stating that it is looking
for a file path of C:\reliable

if I run in the code in the immediate the response's are:

?strSS
C:\database\appointments\appointment_*Les.xls

?strTransfer
Appointment_173_Les.xls

So it finds the file in the correct folder then when it loops to look for
more it appears to be looking elsewhere. I do have a folder C:\reliable but
have no mention of it within my code??

Any suggestions would be appreciated.

TIA
Les
 
M

Michael J. Strickland

LJG said:
Hi Guys,

Am having a problem with some code, I have included this path in the code:

strSS = "C:\database\appointments\appointment_" _
& "*" & rst.Fields("User Name") & ".xls" 'the name of the
field

And fails here:
DoCmd.TransferSpreadsheet acImport, 8, "tempAppointments",
_
strTransfer, True, ""

Yet when I run this code I get an error message stating that it is looking
for a file path of C:\reliable

if I run in the code in the immediate the response's are:

?strSS
C:\database\appointments\appointment_*Les.xls

?strTransfer
Appointment_173_Les.xls

So it finds the file in the correct folder then when it loops to look for
more it appears to be looking elsewhere. I do have a folder C:\reliable
but have no mention of it within my code??

Any suggestions would be appreciated.

TIA
Les

I don't see any reference to strSS in your "DoCmd.TransferSpreadsheet"
statement.

One thing I did notice is that you have included an asterisk ("*") in your
filename. This is not allowed since the asterisk is used as a wildcard in
filename references, not a literal character.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Run-time error '3011' 1
Data Import question 4
Spreadsheet Import 1
Add / Update problem 3
Error 3011 3
Run Time Error 3011 1
TransferSpreadsheet Cannot Find Source Query? 5
Error 3011 7

Top