Promted for File Name during Export

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
It looks to me the destination file pathname is incorrectly constructed.
Try:

DoCmd.TransferSpreadsheet , acExport, acSpreadsheetTypeExcel8,
"L:\Robbie-PSN\N" & me.fieldname &".xls", True
 
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
 
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.
 
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.
 
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.
 
Thank you again. It was the Input box. I actually just dropped the Input
box in the Transfer statement and it worked.
 
Back
Top