🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.bazy-danych.msaccess
Article #137605

Re: Akces 2003 - odświżenie okna Akcesa.

#137605
From: Jacek
Date: Fri, 11 May 2018 13:06
118 lines
4879 bytes
Dnia Tue, 24 Apr 2018 18:21:16 +0200, Zbigniew Bratko napisał(a):

> W dniu 2018-04-24 o 12:45, Jacek pisze:
>> Witajcie.
>> 
>> Przy zamknięciu formularza jest kod zwalniający wcześniej użyte zasoby.
>> Powoduje to, że w oknie Akcesa pozostaje 'biała plama, a czasami
>> obramowanie tego zamkniętego formularza.
>> Jak odświerzyć z poziomu kodu okno Akcesa?
>> 
> 
> [...]
> 
> Spróbuj użyć funkcji DoEvents pomiędzy wywołaniami zwalniającymi
> wcześniej użyte zasoby, bądź ukryj formularz przed zwalnianiem zasobów.
> 
> '_______________________________________________
> Private Sub Form_Unload(Cancel As Integer)
>    Me.Visible = False
>    DoEvents
> End Sub
> 
> Czasami używa się kilkukrotnego wywołania:
> 
> DoEvents: DoEvents: DoEvents

Cześć Zbyszku.
Dziękuję za porade.
Mam jeszcze jedną prośbę.

Sciągnąłem z sieci procedure do drukowania raportów z Akcesa 2003 do PDF,
za pomocą 'PDF Creatora'.

Oto ona:

Sub DrukujPDF2(Raport As String, Sc As String, Plik As String)
'Author       : Ken Puls ( www.excelguru.ca)
'Macro Purpose: Print to PDF file using PDFCreator
'   (Download from http://sourceforge.net/projects/pdfcreator/ )
'   Designed for early bind, set reference to PDFCreator

    Dim pdfjob As PDFCreator.clsPDFCreator
    Dim sPDFName As String
    Dim sPDFPath As String
    Dim sPrinterName As String
    Dim sReportName As String
    Dim lPrinters As Long
    Dim lPrinterCurrent As Long
    Dim lPrinterPDF As Long
    Dim prtDefault As Printer

    '/// Change the report and output file name here! ///
    sReportName = Raport
    sPDFName = Plik
    sPDFPath = Sc
    'If Dir(sPDFPath) = "" Then MkDir (sPDFPath)
    'Resolve index number of printers to allow changing and preserving
    sPrinterName = Application.Printer.DeviceName
    On Error Resume Next
    For lPrinters = 0 To Application.Printers.Count
        Set Application.Printer = Application.Printers(lPrinters)

        Set prtDefault = Application.Printer
        Select Case prtDefault.DeviceName
            Case Is = sPrinterName
                lPrinterCurrent = lPrinters
            Case Is = "PDFCreator"
                lPrinterPDF = lPrinters
            Case Else
                'do nothing
        End Select
    Next lPrinters
    On Error GoTo 0
   
    'Change the default printer
    Set Application.Printer = Application.Printers(lPrinterPDF)
    Set prtDefault = Application.Printer

    'Start PFF Creator
    Set pdfjob = New PDFCreator.clsPDFCreator
    With pdfjob
        If .cStart("/NoProcessingAtStartup") = False Then
            MsgBox "Can't initialize PDFCreator.", vbCritical + _
                    vbOKOnly, "PrtPDFCreator"
            Exit Sub
        End If
        .cOption("UseAutosave") = 1
        .cOption("UseAutosaveDirectory") = 1
        .cOption("AutosaveDirectory") = sPDFPath
        .cOption("AutosaveFilename") = sPDFName
        .cOption("AutosaveFormat") = 0    ' 0 = PDF
        .cClearCache
    End With
    'Print the document to PDF
    DoCmd.OpenReport (sReportName)
    'Wait until the print job has entered the print queue
    Do Until pdfjob.cCountOfPrintjobs = 1
        DoEvents
    Loop
    pdfjob.cPrinterStop = False

    'Wait until PDF creator is finished then release the objects
    Do Until pdfjob.cCountOfPrintjobs = 0
        DoEvents
    Loop
    pdfjob.cClose
    'Reset the (original) default printer and release PDF Creator
    Set Application.Printer = Application.Printers(lPrinterCurrent)
    Set pdfjob = Nothing
End Sub

Potrzebuję ją tak przerobić, żeby móc wywołać wiele razy z kolejnymi
raportami.
Pomożesz, proszę?

---
Ta wiadomość została sprawdzona na obecność wirusów przez oprogramowanie antywirusowe Avast.
https://www.avast.com/antivirus
Technical Details
Message-ID: <mk9q8t75k188.1jevbtij4ue3o$.dlg@40tude.net>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!wsisiz.edu.pl!goblin2!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
References: <hy1v5rsi1u1d.1szbxxptm019r$.dlg@40tude.net> <pbnlhv$sft$1@node2.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!wsisiz.edu.pl!goblin2!goblin1!goblin.stu.neva.ru!newsfeed.neostrada.pl!unt-exc-02.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
From: Jacek <ala@ola.pl>
Subject: Re: Akces 2003 - odświżenie okna Akcesa.
Newsgroups: pl.comp.bazy-danych.msaccess
User-Agent: 40tude_Dialog/2.0.15.1pl
MIME-Version: 1.0
References: <hy1v5rsi1u1d.1szbxxptm019r$.dlg@40tude.net> <pbnlhv$sft$1@node2.news.atman.pl>
Date: Fri, 11 May 2018 15:06:46 +0200
Message-ID: <mk9q8t75k188.1jevbtij4ue3o$.dlg@40tude.net>
X-Antivirus: Avast (VPS 180511-2, 2018-05-11), Outbound message
X-Antivirus-Status: Clean
Lines: 119
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 178.36.223.121
X-Trace: 1526044012 unt-rea-b-01.news.neostrada.pl 31368 178.36.223.121:12542
X-Complaints-To: abuse@news.neostrada.pl
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit