| Chat with a LIVE Microsoft
Access Expert! |
||||
|
||||
|
#1
|
|||
|
|||
|
OutputTo custom filename run time error 3011
I have used the code below to run a report to our server. I need to change the file name each time to be date specific. When I run the code I get run time error 3011 - Microsoft Jet Database Engine could not find object".
When I get that solved - the query that the report runs from requires a date input which should be yesterdays date - what line of code can I enter to do that. Private Sub Option7_Click() Dim outputSNP As Variant outputSNP = "j:\umps\this week\" & "Clock Hours for-" & Format(Now(), "yyyymmdd") & ".snp" DoCmd.OutputTo acReport, "DailyClockReport -All Employees", acFormatSNP, outputSNP, False MsgBox "the report is published to " & outputSNP End Sub Thanks |
| Sponsored Links |
|
#2
|
||||
|
||||
|
Use
Dim outputSNP As String instead of: Dim outputSNP As Variant That's whats expected so why not provide it. Also use the below for yesterdays date outputSNP = "j:\umps\this week\" & "Clock Hours for-" & Format(DateAdd("d", -1, Date), "yyyymmdd") & ".snp"
__________________
Ian build a better system and they'll build a better idiot. |
|
#3
|
|||
|
|||
|
Thanks - I tried it but no change...this is the updated version.
Dim outputSNP As String outputSNP = "j:\umps\this week\" & "Clock Hours for-" & Format(DateAdd("d", -1, Date), "yyyymmdd") & ".snp" DoCmd.OutputTo acReport, "DailyClockReport -All Employees", acFormatSNP, outputSNP, False THanks |
|
#4
|
|||
|
|||
|
Don't know what version you're running, but shouldn't the first OutputTo argument be acOutputReport instead of acReport?
|
|
#5
|
|||
|
|||
|
Whoops, spoke too soon
Apologies,
Please ignore my last remarks - the constants are both equal to '3' according to Object Browser. |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|