I am trying to figure out how to pull data from query results in VBA but i have been unsuccessful so far. I have a form where I enter a client number and date and it pulls a report and saves it automatically.
The only problem is the save path includes [Client#] & " " & [ClientName]. The only way around this I have found is to enter the entire Client name and only pull the first 9 digits to pull all my querys that run off this form. I do have a query that runs off this form and pulls the Client Name with relationship to the client number I have entered.
This is the code I have so far.
The only problem is the save path includes [Client#] & " " & [ClientName]. The only way around this I have found is to enter the entire Client name and only pull the first 9 digits to pull all my querys that run off this form. I do have a query that runs off this form and pulls the Client Name with relationship to the client number I have entered.
This is the code I have so far.
Code:
Private Sub printreport_Click()
Dim blret As Boolean
Dim Filter As String
Dim strClient As String
Dim strDate As String
Dim stdispname As String
Dim stdocname As String
Dim stsumname As String
strClient = txtClient
strDate = txtDate
stdocname = "Results Weekly"
stdispname = "Results Wk Dispute"
stsumname = "Results Weekly - Master"
'Pulls Weekly Reports for client folder
blret = ConvertReportToPDF(stdocname, , "Q:\ClientReports\" & strClient & "\" & strDate & "Weekly.pdf", False, False, 150, "", "", 0, 0, 0)
'Pulls Weekly Reports for cooler e-mail folder
blret = ConvertReportToPDF(stdocname, , "Q:\ClientReports\Cooler Email Weekly\" & Left(strClient, 9) & "Weekly.pdf", False, False, 150, "", "", 0, 0, 0)
'Pulls Weekly Sum Reports for cooler e-mail folder
blret = ConvertReportToPDF(stsumname, , "Q:\ClientReports\Cooler Email Weekly\" & Left(strClient, 9) & "WeeklySummary.pdf", False, False, 150, "", "", 0, 0, 0)
'Pulls Weekly Sum Reports for client folder
blret = ConvertReportToPDF(stsumname, , "Q:\ClientReports\" & strClient & "\" & strDate & "WeeklySummary.pdf", False, False, 150, "", "", 0, 0, 0)
'Pulls Dispute Reports for Client Folder
blret = ConvertReportToPDF(stdispname, , "Q:\ClientReports\" & strClient & "\" & strDate & "Dispute.pdf", False, False, 150, "", "", 0, 0, 0)
'Pull Dispute Report for Cooler e-mail folder
blret = ConvertReportToPDF(stdispname, , "Q:\ClientReports\Cooler Email Wk Dispute\" & Left(strClient, 9) & "Dispute.pdf", False, False, 150, "", "", 0, 0, 0)
End Sub