AccessTr.neT
Form üzerindeki textbox, label VBA ile silme - Baskı Önizleme

+- AccessTr.neT (https://accesstr.net)
+-- Forum: Microsoft Access (https://accesstr.net/forum-microsoft-access.html)
+--- Forum: Access Cevaplanmış Soruları (https://accesstr.net/forum-access-cevaplanmis-sorulari.html)
+--- Konu Başlığı: Form üzerindeki textbox, label VBA ile silme (/konu-form-uzerindeki-textbox-label-vba-ile-silme.html)

Sayfalar: 1 2 3


Cvp: Form üzerindeki textbox, label silme - Masalcı - 25/02/2010

DeleteControl nasıl kullanılacağını bulamadım
object browser da şöyle yazmış

Sub DeleteControl(FormName As String, ControlName As String)

bende kod arasına

Set ctl = DeleteControl("Form2", "Mytextbox1")

yazdım
tabiki oda kabul etmedi

Sub DeleteControl(FormName As String, ControlName As String)

nasıl kullanılmalı
nette şöyle bir kod buldum

Public Function clearForm()

Dim ctl As Control, ctls As Controls
Dim frm As Form
Dim x As String

DoCmd.openForm "JSA Form V2", acDesign

Set frm = Forms![JSA Form V2]
Set ctls = frm.Controls

For Each ctl In frm.Controls
x = Mid(ctl.Properties("Name"), 1, 1)
If x = "X" Then
DeleteControl frm.Name, ctl.Properties("Name")
End If
Next

DoCmd.Close acForm, "JSA Form V2", acSaveYes

End Function


Cvp: Form üzerindeki textbox, label VBA ile silme - assenucler - 25/02/2010

Sayın EriAV;

Dosyanız için teşekkür ederim. Sayın Masalcı'nın kodları sizin isteğinizi karşılıyor mu? Merak ettim...


Cvp: Form üzerindeki textbox, label VBA ile silme - Puletin - 25/02/2010

Bunu bir deneyiniz işinize yarar mı acaba


Kod:
Sub deneme2()

DoCmd.OpenForm "FormAdı", acDesign
DoCmd.RunCommand acCmdSelectAll
DoCmd.RunCommand acCmdDelete

DoCmd.Close acForm, "FormAdı", acSaveYes
End Sub




Cvp: Form üzerindeki textbox, label VBA ile silme - Masalcı - 25/02/2010

bu işe yarıyor
denenmiştir
form2 deki Mytextbox3 isimli texboxu siliyor

Private Sub Komut6_Click()
DoCmd.OpenForm "Form2", acDesign
DeleteControl "form2", "Mytextbox3"
DoCmd.Close acForm, "Form2", acSaveYes
End Sub


Cvp: Form üzerindeki textbox, label VBA ile silme - ErtiAV - 25/02/2010

.mdb db1_yeni.mdb (Dosya Boyutu: 204 KB | İndirme Sayısı: 12)
Evet arkadaşlar sizlerinde yazdığı birkaç örnekten esinlenerek otomatik silmeyi de yaptım Img-grin

Hepimizin ellerine sağlık Img-grin

Private Sub Command5_Click()
Dim ctl As Control
Dim frm As Form

DoCmd.OpenForm "Form2", acDesign
Set frm = Forms!Form2

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
For i = 1 To ctl
DeleteControl frm.Name, "Mytextbox" & i
Next i
End If
Next

DoCmd.Close acForm, "Form2", acSaveYes

DoCmd.OpenForm "Form2", acNormal
End Sub


Cvp: Form üzerindeki textbox, label VBA ile silme - Puletin - 25/02/2010

Sn ArtiAV sorununuzun çözüldüğüne sevindim, ayrıca paylaşım içinde teşekkür ederiz, yalnız eklentilerinizi Foruma eklerken lütfen herhangi bir sıkıştırma programı ile sıkıştırdıktan sonra ekleyiniz. Lütfen Site Kurallarına uyalım.