Greetings
I am trying to automate our invoicing. The tricky bit is that each client has their own directory, plus we always put everything into years. The the full path for each invoice would be say;
C:\Users\RB\Documents\AA All Companies\JJH\Export Documents\ClientA\2012
then for another clients it would be
C:\Users\RB\Documents\AA All Companies\JJH\Export Documents\ClientF\2012
etc
The concept is to store the individual folder location in a field in the table and then call that field when I query the name of the client being invoiced. It is obvious that I have made an error in the way I am trying to setup the variables to combine them together to make the full location and file name.
My code thus far ;
Private Sub btn_PDFInv_Disc_Click()
Dim myPath As String
Dim myPathName As String
Dim myPathDest As String
Dim strReportName As String
Dim strDocName As String
Dim strLinkCriteria As String
strDocName = "rpt_JJH_ExportInvoice_Discount"
strLinkCriteria = "[INVOICENUMBER] = Forms![frm_JJH_Data_Export_SalesData]![INVOICENUMBER]"
myPath = "C:\Users\RB\Documents\AA All Companies"
myPathName = [Forms]![frm_JJH_DATA_Export_SalesData]![cboClientID].Column(3)
myPathDest = myPathName & " \ "
strReportName = [Forms]![frm_JJH_DATA_Export_SalesData]![INVOICENUMBER] & " - " & [Forms]![frm_JJH_DATA_Export_SalesData]![CLIENTORDERNUMBER] & " .pdf"
DoCmd.OpenReport strDocName, acViewPreview, , strLinkCriteria
DoCmd.OutputTo acOutputReport, strDocName, acFormatPDF, myPath + myPathDest + strReportName, False
Forms![frm_JJH_DATA_Export_SalesData].[PRINTED] = "Yes"
DoCmd.Close acReport, strDocName
It is frustration me as I can do this is I set the full path in the mypath string but due to the variables each pdf file has to go to the individual companies own folder.
thanks
~mike