J
Joe D
A2K3 (latest patches), WinXP Pro
Struggling with code to delete (remove) a tab (page) in a form using VBA. I
have a need to modify tab contents in a form through VBA (caption and subform
sourceobject) then remove tabs (pages) no longer needed at that time. My
modification code works without flaw. However, the code I gathered from VBA
Help and MSDN (same as Help) to remove a tab (page) isn't functioning for me.
Here's my code, based on the Help example:
Public Function RemovePage() As Boolean
Dim frm As Form
Dim tbc As TabControl
DoCmd.OpenForm "Salesman Budgets Dev", acDesign
Set frm = Forms![Salesman Budgets Dev]
Set tbc = frm!Tab36
tbc.Pages.Remove
RemovePage = True
DoCmd.Save
DoCmd.Close
End Function
I had to add opening the form in design mode (not included in the Help
example) because other instructions say it is needed and code fails
immediately without it.
I get an error 13 Type Mismatch on "Set tbc = frm!Tab36". Tab36 is the Name
of the page to be removed.
The Help code also includes a Dim of "pge as Page" but never uses it. I
suspect there may be a glitch in the Help example code, or there is something
I just don't see.
I have tried many variations without success (far too many to list here).
If anyone has experience with this situation and can help me get on the right
track with the code, I would much appreciate it.
TIA
Joe D
Struggling with code to delete (remove) a tab (page) in a form using VBA. I
have a need to modify tab contents in a form through VBA (caption and subform
sourceobject) then remove tabs (pages) no longer needed at that time. My
modification code works without flaw. However, the code I gathered from VBA
Help and MSDN (same as Help) to remove a tab (page) isn't functioning for me.
Here's my code, based on the Help example:
Public Function RemovePage() As Boolean
Dim frm As Form
Dim tbc As TabControl
DoCmd.OpenForm "Salesman Budgets Dev", acDesign
Set frm = Forms![Salesman Budgets Dev]
Set tbc = frm!Tab36
tbc.Pages.Remove
RemovePage = True
DoCmd.Save
DoCmd.Close
End Function
I had to add opening the form in design mode (not included in the Help
example) because other instructions say it is needed and code fails
immediately without it.
I get an error 13 Type Mismatch on "Set tbc = frm!Tab36". Tab36 is the Name
of the page to be removed.
The Help code also includes a Dim of "pge as Page" but never uses it. I
suspect there may be a glitch in the Help example code, or there is something
I just don't see.
I have tried many variations without success (far too many to list here).
If anyone has experience with this situation and can help me get on the right
track with the code, I would much appreciate it.
TIA
Joe D