Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-17-2002, 12:32 PM
Ste4en Ste4en is offline
Registered User
 
Join Date: Sep 2001
Posts: 142
Ste4en
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
Reply With Quote
Sponsored Links
  #2  
Old 12-17-2002, 02:01 PM
Fornatian's Avatar
Fornatian Fornatian is offline
Dim Person
 
Join Date: Aug 2000
Location: England
Posts: 1,396
Fornatian is on a distinguished road
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.
Reply With Quote
  #3  
Old 12-17-2002, 04:10 PM
Ste4en Ste4en is offline
Registered User
 
Join Date: Sep 2001
Posts: 142
Ste4en
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
Reply With Quote
  #4  
Old 12-17-2002, 04:58 PM
jjturner jjturner is offline
Registered User
 
Join Date: Aug 2002
Location: Boston, MA
Posts: 379
jjturner is on a distinguished road
Don't know what version you're running, but shouldn't the first OutputTo argument be acOutputReport instead of acReport?
Reply With Quote
  #5  
Old 12-17-2002, 05:09 PM
jjturner jjturner is offline
Registered User
 
Join Date: Aug 2002
Location: Boston, MA
Posts: 379
jjturner is on a distinguished road
Whoops, spoke too soon

Apologies,

Please ignore my last remarks - the constants are both equal to '3' according to Object Browser.
Reply With Quote
Sponsored Links
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World