OK I know nothing about VB, but I've been tasked with tidying up the reporting and changing a few things, In access they clicked a button ran some reports and emailed them off, unfortunately they get about 23 emails one after another so I decided to put them all into a folder on the network.
Now my problem is, if I just run it from a Macro it works fine, once I then try and put it to work from the button it does nothing other than prompt from the drive letter and dates. When it comes to execute the queries is does nothing.
Anyone tell me why?
So the button does this...
Then this
Thanks, I can't figure out whats changed.
Now my problem is, if I just run it from a Macro it works fine, once I then try and put it to work from the button it does nothing other than prompt from the drive letter and dates. When it comes to execute the queries is does nothing.
Anyone tell me why?
So the button does this...
Code:
Private Sub Command108_Click()
RunMonthlyStats
End Sub
Then this
Code:
Option Compare Database
Dim InputStartDate As String
Dim InputEndDate As String
Option Explicit
Public Function Output_Test()
Dim message, title, defaultValue As String
Dim myValue As String
Dim Drive, My As String
Dim fso As FileSystemObject
message = "Enter the drive letter that is mapped to E-HEALTHCARESUPPORT"
title = "Monthly Report Output Location"
defaultValue = "S"
myValue = InputBox(message, title, defaultValue)
InputStartDate = InputBox("Please enter Start Date:", "Start Date")
InputEndDate = InputBox("Please enter End Date:", "End Date")
If myValue = "" Then myValue = defaultValue
'Drive = "\\tsclient\" + myValue + "\05_Proj_Mgmt_Results_and_Rpts\Msmt_Data\Monthly_USD_Reporting"
Drive = "\\fileshares.corp.hp.com\groups\e-healthcaresupport\" + myValue
On Error Resume Next
If Dir(Drive, vbDirectory) = "" Then
MsgBox ("Directory does not exist: " & vbNewLine & vbNewLine & Drive)
Exit Function
End If
DoCmd.OutputTo acOutputQuery, "zzPM_Output_Test", acFormatXLS, Drive + "\Test_Output.xls", False
DoCmd.OutputTo acOutputQuery, "zzPM_Output_Test1", acFormatXLS, Drive + "\Test_Output1.xls", False
End Function
Public Function StartDate() As String
StartDate = InputStartDate
End Function
Public Function EndDate() As String
EndDate = InputEndDate
End Function
Thanks, I can't figure out whats changed.