Change filename of Exported Textfile

mattcdse

Registered User.
Local time
Today, 08:44
Joined
Nov 23, 2005
Messages
42
Hi All,

I have this line of code:

DoCmd.TransferText acExportDelim, "Dhcp Specification", "tblDHCP", "U:\" & [Forms]![frmExportDHCP]![cmbServer] & ".txt", False, "", 850

Where the section highlighted is a combo box on a form. I was trying to use the value in this combo box to describe the filename of the text file I was exporting to. However I get the error:

The Microsoft Jet Databse Engine could not fond the object 'X#txt'. Make sure the object exists and the you spell it name and path name coreectly.

Where X is the string stored in the combo box.

Any ideas where I have gone wrong/what could be improved?

Cheers,

Matt
 
If the form isn't open, the object doesn't exist.

The [Forms] collection is all OPEN forms. If this object is referenced from something else, that something else needs to verify that the referenced form is open. If this reference is in the class module of the form holding this combo box, try this reference as Me![cmbServer]
 

Users who are viewing this thread

Back
Top Bottom