Dlookup in report Outputname string

M

Melanie O

I am trying to export a report with a dlookup in the outputname string.

strOutputName = "\\L:\Daily Reports\Brokerage Comb Report " & DLookup("[End
Date]", "Daily Criteria") & ".rtf"

The following error message appears when the report is exported:

Microsoft Office Access can't save the output data to the file you've
selected.

The export works if the dlookup is removed. Any ideas what might be wrong
with the code?

Thanks,
Melanie
 
O

Ofer

The date field has / chr in it, and that is a problem for a file name, try
this instead

strOutputName = "\\L:\Daily Reports\Brokerage Comb Report " &
format(DLookup("[End Date]", "Daily Criteria"),"ddmmyyyy") & ".rtf"
 
M

Melanie O

Thanks. Worked great!

Melanie

Ofer said:
The date field has / chr in it, and that is a problem for a file name, try
this instead

strOutputName = "\\L:\Daily Reports\Brokerage Comb Report " &
format(DLookup("[End Date]", "Daily Criteria"),"ddmmyyyy") & ".rtf"


Melanie O said:
I am trying to export a report with a dlookup in the outputname string.

strOutputName = "\\L:\Daily Reports\Brokerage Comb Report " & DLookup("[End
Date]", "Daily Criteria") & ".rtf"

The following error message appears when the report is exported:

Microsoft Office Access can't save the output data to the file you've
selected.

The export works if the dlookup is removed. Any ideas what might be wrong
with the code?

Thanks,
Melanie
 
Top