Excel VBA to produce Access report based on specific parameters

ccordner

Active Member
Joined
Apr 28, 2010
Messages
355
Hi

I use the code below to output a report for yesterday's activities in the daily log. The report is based on a query which filters only the events from yesterday to output.

Code:
Set objaccess = CreateObject("Access.Application")
objaccess.AutomationSecurity = msoAutomationSecurityLow
objaccess.Visible = False
objaccess.OpenCurrentDatabase "\\bdifps01\Groups\Platform.Supervisor\DO NOT USE - Log (Front).accdb"
objaccess.DoCmd.OutputTo acOutputReport, "rptSupervisorsLogPreviousDay", acFormatPDF, Folder & "\BDI Supervisors Log for " & Format(Date - 1, "d") & " " & Format(Date - 1, "mmm") & " " & Format(Date - 1, "yy") & ", Created at " & Format(Time, "hhmm") & " on " & Format(Date, "d mmm yy") & ".pdf", , False

However, I would like to be able to do a historic enquiry - say the log for three days ago was not compiled, I would like to be able to output the report based on a date in a userform.

Any ideas?

Thanks
Chris
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

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