Removing Controls in Access forms using VB
-
I'm writing a small app in Access using VB. I need to loop through all of the control names in the form and then delete the one in which the control name is "Title", and which is a label. 'Suppose all declarations are already made'
For Each ctl In frm.Controls If ctl.ControlType = acLabel Then If ctl.name = "Title" Then ctl.?????? - removing/deleting step End If End If Next ctl
I don't know how to actually delete the controls. I can ADD controls and EDIT them OK, but deleting them is misleading me. Any ideas? Thanks. -
I'm writing a small app in Access using VB. I need to loop through all of the control names in the form and then delete the one in which the control name is "Title", and which is a label. 'Suppose all declarations are already made'
For Each ctl In frm.Controls If ctl.ControlType = acLabel Then If ctl.name = "Title" Then ctl.?????? - removing/deleting step End If End If Next ctl
I don't know how to actually delete the controls. I can ADD controls and EDIT them OK, but deleting them is misleading me. Any ideas? Thanks. -
reegan41 wrote:
I'm writing a small app in Access using VB.
That's not VB. It's Access VBA. Try posting your question in the SQL forum.
Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
Actually, I've seen VBA questions here before. VBA is more VB than it is SQL, I'd say the problem is that we really don't have a 'right' forum for this question.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I'm writing a small app in Access using VB. I need to loop through all of the control names in the form and then delete the one in which the control name is "Title", and which is a label. 'Suppose all declarations are already made'
For Each ctl In frm.Controls If ctl.ControlType = acLabel Then If ctl.name = "Title" Then ctl.?????? - removing/deleting step End If End If Next ctl
I don't know how to actually delete the controls. I can ADD controls and EDIT them OK, but deleting them is misleading me. Any ideas? Thanks.reegan41 wrote:
For Each ctl In frm.Controls If ctl.ControlType = acLabel Then If ctl.name = "Title" Then ctl.?????? - removing/deleting step End If End If Next ctl
Just guessing... but isn't frm.Controls a collection? If so, you should be able to delete from it?