M
MikeC
AJW,
I made a couple tweaks to your code, including declaring
the variables. I had to add a reference to the Microsoft
Office Object Library. This code works for me.
Dim cBars As CommandBars
Dim cBarCtl As CommandBarButton
DoCmd.SelectObject acTable, , True
Set cBars = Application.CommandBars
Set cBarCtl = cBars.FindControl(msoControlButton, 3812)
If Not cBarCtl Is Nothing Then
cBarCtl.Execute
End If
Set cBars = Nothing
Set cBarCtl = Nothing
I made a couple tweaks to your code, including declaring
the variables. I had to add a reference to the Microsoft
Office Object Library. This code works for me.
Dim cBars As CommandBars
Dim cBarCtl As CommandBarButton
DoCmd.SelectObject acTable, , True
Set cBars = Application.CommandBars
Set cBarCtl = cBars.FindControl(msoControlButton, 3812)
If Not cBarCtl Is Nothing Then
cBarCtl.Execute
End If
Set cBars = Nothing
Set cBarCtl = Nothing