Hello,
I've created a shortcut menu for a label on a form with buttons to open other forms. All works well. Now, I would like to add a textbox to the shortcut menu, so that users can enter a job number and have the form open to that number, basically a search option. I've tried various code and can get nothing to work.
The shortcut menu code is from this post: Turn off Shortcut Menu on Reports
The code I've tried is this:
I can get 'Job Number:' to appear in the shortcut menu without a textbox, but if I click on it, it errors on the msgbox function with Error # 438 Object doesn't support this property or method.
I've spent days researching and trying various code.
If anyone can help, I would greatly appreciate it.
Thanks in advance,
Pam
I've created a shortcut menu for a label on a form with buttons to open other forms. All works well. Now, I would like to add a textbox to the shortcut menu, so that users can enter a job number and have the form open to that number, basically a search option. I've tried various code and can get nothing to work.
The shortcut menu code is from this post: Turn off Shortcut Menu on Reports
The code I've tried is this:
Code:
At top of page:
Public Const ControlEdit = 2
In shortcut menu sub:
'Set bx = cbar.Controls.Add(ControlEdit, , , , True)
'Set bx = cbar.Controls.Add(Type:=msoControlEdit)
Set bx = cbar.Controls.Add
With bx
.Caption = "&Job Number:" ' The & underlines the initial character
.OnAction = "=fnJobNumber()"
.FaceId = 3
End With
Public Function fnJobNumber()
MsgBox CommandBars("ContactMenu").Controls("Job Number:").Text
'MsgBox CommandBars("ContactMenu").Controls("&Job Number:").Text
End Function
I can get 'Job Number:' to appear in the shortcut menu without a textbox, but if I click on it, it errors on the msgbox function with Error # 438 Object doesn't support this property or method.
I've spent days researching and trying various code.
If anyone can help, I would greatly appreciate it.
Thanks in advance,
Pam