🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Usuwanie tabel z konkretnym składnikiem w nazwie

#137816
From: LX'yrs
Date: Sat, 27 Aug 2022 11:58
53 lines
2543 bytes
W dniu 14.08.2022 o 13:04, Phantom pisze:
> Dzień dobry
> Dotyczy: MSAccess2000
> 
> Proszę o pomoc.
> Potrzebuję usuwać hurtowo (za pośrednictwem kodu) tabele lokalne mające w  swojej nazwie składnik "tymcz", czyli np.:
> Zestawieniatymcz
> Fakturytymcz
> Okresytymcz
> ....
> ....
> 
> 
> 
> Z góry dziękuję za pomoc
> Pozdrawiam
> Tomek


' Wywołanie:
' wydruk tabel - UsuwajTabeleTymcz()
' usuwanie tabel - - UsuwajTabeleTymcz(True)
'-------------------------------------------------------------------
Public Function UsuwajTabeleTymcz(Optional blnKasuj As Boolean = False)
Dim db As DAO.Database
Dim strNazwaTabeli As String
Dim i As Integer

Const conTYMCZ As String = "tymcz"

   'On Error Resume Next
   Set db = CurrentDb
     For i = 0 To db.TableDefs.Count - 1
       strNazwaTabeli = db.TableDefs(i).Name
       If Left$(strNazwaTabeli, 4) <> "MSys" Then
         'Jeżeli składnik "tymcz" zawsze występuje na końcu
         'to użyj ewentualnie: If Right$ (strNazwaTabeli,5) = conTYMCZ
         If InStr(1, strNazwaTabeli, conTYMCZ, vbTextCompare) > 0 Then
           If blnKasuj = True Then
             db.TableDefs.Delete strNazwaTabeli
           Else
             Debug.Print i, strNazwaTabeli
           End If
         End If
       End If
     Next
   Set db = Nothing

End Function

-- 
Pozdrawiam
LX'yrs
Technical Details
Message-ID: <630a06df$0$6212$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
References: <8918c3fe-3355-4b71-9877-886f5036ebb0n@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!fu-berlin.de!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Sat, 27 Aug 2022 13:58:17 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0
Subject: Re: Usuwanie tabel z konkretnym składnikiem w nazwie
Newsgroups: pl.comp.bazy-danych.msaccess
References: <8918c3fe-3355-4b71-9877-886f5036ebb0n@googlegroups.com>
From: LX'yrs <65Plus@LXyrs.pl>
In-Reply-To: <8918c3fe-3355-4b71-9877-886f5036ebb0n@googlegroups.com>
Lines: 53
Message-ID: <630a06df$0$6212$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 31.0.120.124
X-Trace: 1661601503 unt-rea-a-01.news.neostrada.pl 6212 31.0.120.124:2052
X-Complaints-To: abuse@news.neostrada.pl
X-Received-Bytes: 2457
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit