Promted for File Name during Export

G

Guest

I am using this command to actually require the user to enter the file name
on export. I keep getting a break in my code saying Lotus.wks file formats
aren't supported in the current version of Microsoft Acess. So not really
sure what I have enter wrong since indicating type as excel.

DoCmd.TransferSpreadsheet , acExport, acSpreadsheetTypeExcel8,
"L:\Robbie-PSN\N""&me.fieldname&"".xls""", True, ""

Thanks, H. Flynn
 
V

Van T. Dinh

It looks to me the destination file pathname is incorrectly constructed.
Try:

DoCmd.TransferSpreadsheet , acExport, acSpreadsheetTypeExcel8,
"L:\Robbie-PSN\N" & me.fieldname &".xls", True
 
G

Guest

Thank you was having one of the duh moments :)

Van T. Dinh said:
It looks to me the destination file pathname is incorrectly constructed.
Try:

DoCmd.TransferSpreadsheet , acExport, acSpreadsheetTypeExcel8,
"L:\Robbie-PSN\N" & me.fieldname &".xls", True
 
G

Guest

Ok abit lost still.. It no longer error but I am having issues figuring out
how to define the function me.fieldname so it will bring up a box for the
user the enter the file name.
I am new at this an any assistance is most welcome.
 
G

Guest

Ok still abit lost I am afraid. I have taken care of the error with the
correction below now I am having an issue defining the funtion so it brings
up a box for the user to input the file name.

Any help would be welcome. Even if it is pointing me in the direction of a
better idea on how to define.
 
V

Van T. Dinh

Me.FieldName

seems to refer to a TextBox Control on the Form where you run the
TransferSpreasheet code.

I think the usual set-up is that you open a "frmImport" with a TextBox so
that the user can enter the FileName and a CommandButton to run the code.
When the user wants to export, he/she opens the frmImport, enter the
FileName in the TextBox and then hit the CommandButton to export.

If you don't have this set-up, check Access VB on the InputBox() function.
 
G

Guest

Thank you again. It was the Input box. I actually just dropped the Input
box in the Transfer statement and it worked.
 

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

Top