D
dale
I used some code that I had gotten from a Microsoft Access newsgroup
that seemed to work in Access 2000. I have upgraded to XP and it does
not work anymore. The code is in a module is as follows. Any help is
appreciated.
Public Sub changemenu()
Dim cmd As QueryDef
Dim rcs As Recordset
Set cmd = CurrentDb.QueryDefs("labelmapquery")
Set rcs = cmd.OpenRecordset
Dim cbr As CommandBar
For Each cbr In CommandBars
listbar 1, cbr, rcs
Next cbr
End Sub
Public Sub listbar(Level As Integer, thisbar As CommandBar, rcs As
Recordset)
Dim cbrctl As CommandBarControl
For Each cbrctl In thisbar.Controls
rcs.MoveFirst
While (Not rcs.EOF And Not rcs.BOF)
If cbrctl.Caption = rcs("oldlabel").Value Then
cbrctl.Caption = rcs("newlabel").Value
rcs.MoveNext
Wend
' If the control doesn't have a command bar associated
' with it, then don't print it.
If cbrctl.Type <> 1 And cbrctl.Type <> 2 And cbrctl.Type <> 4
And cbrctl.Type <> 16 And cbrctl.Type <> 18 Then
listbar Level + 1, cbrctl.CommandBar, rcs
End If
Next cbrctl
End Sub
that seemed to work in Access 2000. I have upgraded to XP and it does
not work anymore. The code is in a module is as follows. Any help is
appreciated.
Public Sub changemenu()
Dim cmd As QueryDef
Dim rcs As Recordset
Set cmd = CurrentDb.QueryDefs("labelmapquery")
Set rcs = cmd.OpenRecordset
Dim cbr As CommandBar
For Each cbr In CommandBars
listbar 1, cbr, rcs
Next cbr
End Sub
Public Sub listbar(Level As Integer, thisbar As CommandBar, rcs As
Recordset)
Dim cbrctl As CommandBarControl
For Each cbrctl In thisbar.Controls
rcs.MoveFirst
While (Not rcs.EOF And Not rcs.BOF)
If cbrctl.Caption = rcs("oldlabel").Value Then
cbrctl.Caption = rcs("newlabel").Value
rcs.MoveNext
Wend
' If the control doesn't have a command bar associated
' with it, then don't print it.
If cbrctl.Type <> 1 And cbrctl.Type <> 2 And cbrctl.Type <> 4
And cbrctl.Type <> 16 And cbrctl.Type <> 18 Then
listbar Level + 1, cbrctl.CommandBar, rcs
End If
Next cbrctl
End Sub