Exporting report with dlookups in heading

rabravenec1

New Member
Joined
Feb 11, 2019
Messages
2
I am using VBA to export an Access Report which uses dlookups in the heading to set a value to an actually month name.

This dlookup values work good when using the following.
DoCmd.OutputTo acOutputReport, "rpt_DivisionDoc_LTM_Coll", acFormatPDF, strFileName, False

However, when I attempt to take the same report and export it to access using
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qry_DivisionDoc_Test_FY_Coll_LTM", strFileName3, False

The dlookup values do not transfer to the spreadsheet.

I've tried different methods to export this report and have it transfer the heading values retrieved by the dlookups in the reports and find
that it does work fine with the
DoCmd.OutputTo acOutputReport, "Rpt_DivisionDoc_LTM_Coll", acFormatTXT, strFileName4, False string.

But, I need the report in Excel with the actual dlookup values.

Please help... users driving me crazy...
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
put the headings in the query.
if you use a form , make textbox that has the dlookup (or other method)
the query get this off the form,
the query exports with the data.
 
Upvote 0
put the headings in the query.
if you use a form , make textbox that has the dlookup (or other method)
the query get this off the form,
the query exports with the data.

Thank you Ranman256

In theory, this makes perfect since. However, this database is one that I was given control over last year. There are over 300 reports and queries. This will require way too much modifications to the reports and the queries, that I am not comfortable with doing.

Richard
 
Upvote 0
Instead of updating the query already there, you could create a new query that selects from the query underlying your report and then add the lookup field to it. Then you can use TransferSpreadsheet to export the new query while leaving the report's record source untouched.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,728
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top