🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Funkcja ColumHidden w Tabeli lub Kwerendzie

#137511
From: Zbigniew Bratko
Date: Fri, 28 Jul 2017 13:59
50 lines
2106 bytes
W dniu 2017-07-26 o 15:56, Marek Idźkowski pisze:
> Witam
> Proszę o pomoc w oprogramowaniu przycisku, gdzie po kliknięciu Ukryje nam automatycznie jedną lub wiele różnych kolumn
> 
> Próbowałem
> z
> 
> Private Sub Przycisk_Click()
> 
>      [Pole].ColumnHidden = True
> 
> End Sub
> 
> 
> Niestety nie działa z aktywną tabelą lub kwerendą, a chyba jedynie z formularzami
> 
> być może należy dodać nazwę tabeli lub kwerendy przed tym kodem.

[...]

na stronie
  https://msdn.microsoft.com/en-us/library/office/aa224064(v=office.11).aspx
jest stosowny przykład.

Możesz także wypróbować poniższy przykład:
'______________________________
Private Sub Polecenie1_Click()

Dim frm As Access.Form
Const cTblName As String = "JakasTabela"
Const cColName As String = "TwojaKolumna"

   ' ustaw fokus na oknie tabeli
   DoCmd.SelectObject acTable, cTblName, False
   DoEvents: DoEvents: DoEvents

   Set frm = Screen.ActiveDatasheet.Form

     ' ukryj kolumnę
     frm.Controls(cColName).ColumnHidden = True

   Set frm = Nothing

End Sub

-- 
Pozdrowienia
BraZby
www.faq.accdb.pl
www.accdb.pl
Technical Details
Message-ID: <olfg12$2me$1@node2.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <c3283c72-bc15-4a09-9655-3c44f1fae58a@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Zbigniew Bratko <byle@co.pl>
Newsgroups: pl.comp.bazy-danych.msaccess
Subject: Re: Funkcja ColumHidden w Tabeli lub Kwerendzie
Date: Fri, 28 Jul 2017 15:59:53 +0200
Organization: ATMAN - ATM S.A.
Lines: 50
Message-ID: <olfg12$2me$1@node2.news.atman.pl>
References: <c3283c72-bc15-4a09-9655-3c44f1fae58a@googlegroups.com>
NNTP-Posting-Host: ip-31-0-122-133.multi.internet.cyfrowypolsat.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1501250402 2766 31.0.122.133 (28 Jul 2017 14:00:02 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Fri, 28 Jul 2017 14:00:02 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
In-Reply-To: <c3283c72-bc15-4a09-9655-3c44f1fae58a@googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit