1

How can I set up a DSN to direct to a specific location, but then allow me to select the file rather than writing to a specific file.

[ODBC]
DRIVER=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
ReadOnly=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=excel 12.0
DriverId=1046
DefaultDir=Drive:\exportdirectory
DBQ=Drive:\exportdirectory\file.xlsx

The below will write to \exportdirectory\file.xlsx

If I use any of the following

DefaultDir=Drive:\exportdirectory\*xls*
(no DBQ)


DefaultDir=Drive:\exportdirectory\*
(no DBQ)

DefaultDir=Drive:\exportdirectory
DBQ=Drive:\exportdirectory\*xls*

DefaultDir=Drive:\exportdirectory
DBQ=Drive:\exportdirectory\*

DefaultDir=Drive:\exportdirectory
DBQ=*.xls*

I get the desired behaviour, but it's a bit of a hack: after an error message (trying to write to the file ".xls and failing) it brings up "select workbook" in the defaultdir.

Omitting DBQ just writes to the file ".xls" in the default directory, as does DBQ=*

Some_Guy
  • 794

0 Answers0