Dears,
I have a table where I have ProjectName, City and etc. I want from Access to spit out in separate files pdf files for every City in every ProjectName folder.
Can I have rough idea on how to do it :(. Right now what I have is this. Which is spitting One folder one file by City. So they change their mind and now requiered from me by project where every project has in separate pdf files for each city -
Do While Not rst2.EOF
-
ktrcode = rst2![ParentID]
-
agreement = Mid(rst2![Project], 13, 6)
-
-
ProjectPath = "C:\CachePDF" & "\" & ktrcode & "\Project\" & "Project" & rst2![ProjectCode] & " " & Format(rst2![GenDate] - 1, "yyyy.mm.dd") & ".pdf"
-
-
-
If Len(Dir("c:\CacheCDRPDF\" & ktrcode & "\Project\", vbDirectory)) = 0 Then
-
MkDir "c:\CacheCDRPDF\" & ktrcode & "\Project\"
-
End If
-
-
-
strRptFilter = "[Project Number] = '" & rst2![ProjectName] & "' AND [City] = '" & Me.txtCityNAC & "'"
-
-
DoCmd.OutputTo acOutputReport, "rptProjectDaily", acFormatPDF, ProjectPath
-
I would appreciate any help I just messing around and could not get any desired result
2 1171 zmbd 5,501
Recognized Expert Moderator Expert
What are you getting?
Line 5: you have "yyyy.mm.dd" as the date format. On my network, IT has the antivirus automatically quarentine any file that has a multiple periods in the name as that is how many virus in the past tried to hide.
Line13: Very carfully check this, you have [project number] and yet pulling from RST2![ProjectNAME]
I also do not see where you are using this string.
Here is all the code.
Line 5: doesnt matter its working with me you can just ignore the date formating
Line 13: I`m sorry I didnt want to copy paste so I thought you could understand :( what I want with that piece of data here we go full of it.
All I need to do right now instead of doing one file for all the cities in each Work Folder(Project), I need to do All cities in separate files in Work Folder. -
Private Sub cmdCreatePdf_Click()
-
Dim Cashlocation As String
-
Dim agreement As String
-
Dim ktrcode As String
-
-
If Len(Dir("c:\CachePDF", vbDirectory)) = 0 Then
-
MkDir "c:\CachePDF"
-
End If
-
-
'Clear Temporary Folder Structure
-
Dim FSO As Object
-
-
Dim MyPath As String
-
Set FSO = CreateObject("scripting.filesystemobject")
-
MyPath = "C:\CachePDF"
-
If Right(MyPath, 1) = "\" Then
-
MyPath = Left(MyPath, Len(MyPath) - 1)
-
End If
-
If FSO.FolderExists(MyPath) = False Then
-
MsgBox MyPath & " doesn't exist"
-
Exit Sub
-
End If
-
'Delete files
-
FSO.DeleteFile MyPath & "\*.*", True
-
'Delete subfolders
-
FSO.DeleteFolder MyPath & "\*.*", True
-
Set rst = CurrentDb.OpenRecordset("SELECT DISTINCT [Work], [GenDate], [ParentID] FROM [tblCash] WHERE (([City]) = '" & Me.txtCityNAC & "') ORDER BY [Work];", dbOpenSnapshot)
-
If rst.RecordCount = 0 Then
-
-
rst.Close
-
Set rst = Nothing
-
If rst.RecordCount <> 0 Then
-
Do While Not rst.EOF
-
-
ktrcode = rst![ParentID]
-
agreement = Mid(rst![Work], 13, 6)
-
-
Cashlocation = "C:\CachePDF" & "\" & ktrcode & "\" & "Cash " & rst![Work] & " " & Format(rst![GenDate] - 1, "yyyy.mm.dd") & ".pdf"
-
-
If Len(Dir("c:\CachePDF\" & ktrcode & "\", vbDirectory)) = 0 Then
-
MkDir "c:\CachePDF\" & ktrcode & "\"
-
End If
-
-
-
strRptFilter = "[Work] = '" & rst![Work] & "' AND [City] = '" & Me.txtCityNAC & "'"
-
-
-
DoCmd.OpenReport "rptCash", acViewPreview, , , acHidden
-
DoCmd.OutputTo acOutputReport, "rptCash", acFormatPDF, Cashlocation, True
-
DoCmd.Close acReport, "rptCash"
-
-
SendEmailCash
-
-
DoEvents
-
rst.MoveNext
-
-
Loop
-
End If
-
End If
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Joris Kempen |
last post by:
Hi people,
I know that the question has come around sometimes:
How to open an Access Report using ASP and export it to for example
RTF.
I'm trying to implement the first method of David...
|
by: gudia |
last post by:
I want to Programatically generate Access reports in the pdf format
using some tool and then email them to people in the same code. Right
now I am trying to do this with pdf995 using VBA (emailing...
|
by: cyranoVR |
last post by:
This is the approach I used to automate printing of Microsoft Access
reports to PDF format i.e. unattended and without annoying "Save As..."
dialogs, and - more importantly - without having to use...
|
by: Steven Taylor |
last post by:
Hope someone can help.
I have an application whereby in order to create one document type I
effectively print out 3 or 4 access reports in correct order. So the
user goes to the printer,...
|
by: Brian Barnes |
last post by:
I've been searching using google trying to find a way to display
Access Reports via ASP.NET and only finding commericial products which
appear to require that the report needs to be converted every...
| |
by: David |
last post by:
Does anyone know how to run MS Access reports from VB.net. I'd like to keep
the existing reports in the database if I can.
Thanks
David
|
by: dkurtz |
last post by:
D. Lesandrini published an article some time ago about exporting Access
reports as XML, and then updating those XML reports dynamically in
..NET....
|
by: JoeW |
last post by:
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report,...
|
by: shimul |
last post by:
Hi All,
I am trying to combine multiple access reports in one PDF using pdfcreator, however it doesn't work for me...
Can you please check the following code:
Sub...
|
by: nicodg |
last post by:
** Edit ** This post was added to an existing thread (How to save an Access report to pdf with filename based on fieldname) in error so it's been moved here.
Hello to all again.
my little...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| | |