Shortcut Menu Textbox (1 Viewer)

Phisaw

New member
Local time
Today, 07:44
Joined
Aug 11, 2010
Messages
12
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:
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
 

isladogs

MVP / VIP
Local time
Today, 13:44
Joined
Jan 14, 2017
Messages
18,209
Use a combo box or listbox giving the available job numbers to choose from
 

Phisaw

New member
Local time
Today, 07:44
Joined
Aug 11, 2010
Messages
12
Use a combo box or listbox giving the available job numbers to choose from
Thank you for responding. Are you saying a combo/list box on the shortcut (pop out) menu? I had thought of using a combo box on the form itself, not in the shortcut menu, but didn't like that idea. We have a large number of jobs in this database.
Is it not possible to have a text box in the shortcut menu?
Thanks again,
Pam
 

Micron

AWF VIP
Local time
Today, 08:44
Joined
Oct 20, 2018
Messages
3,478
Why not have the shortcut menu on a textbox and use that for the data filter?
Although, what's wrong with the combo on the form? A large number of jobs? May not matter - perhaps the list can be filtered using cascading combos to restrict results to some sort of grouping. It seems odd to put the shortcut on a label, especially if it's attached to a textbox anyway.
 

Micron

AWF VIP
Local time
Today, 08:44
Joined
Oct 20, 2018
Messages
3,478
I don't think so. I got the thing to work without changing that, but there are other issues with that code. As I alluded to in your thread on commandbars, I think part of the issue here is that commandbars (menu type) can't have textboxes but I suspect that a popup menu can. Not sure. So I got the little menu to show and the function to run but couldn't show a textbox on that menu.
 

zeroaccess

Active member
Local time
Today, 07:44
Joined
Jan 30, 2020
Messages
671
Why not have the shortcut menu on a textbox and use that for the data filter?
Although, what's wrong with the combo on the form? A large number of jobs? May not matter - perhaps the list can be filtered using cascading combos to restrict results to some sort of grouping. It seems odd to put the shortcut on a label, especially if it's attached to a textbox anyway.
For ease of use, it is much faster to enter a job number than it is to click through several combo boxes.

This would be very easy to do: add a criteria in the record source query for the form that opens after you choose a job to:

[Forms]![frmExample]![txtJobID]

Then after update of the text box, just

NGINX:
    docmd.OpenForm "frmJob"

This assumes you have primary keys for something like "JobID".
 

Micron

AWF VIP
Local time
Today, 08:44
Joined
Oct 20, 2018
Messages
3,478
For ease of use, it is much faster to enter a job number than it is to click through several combo boxes.
I guess so, but I didn't presume that the user had the number at hand.

for the form that opens after you choose a job to
How is that choice made if the original problem hasn't been solved? So far, there's no textbox in a shortcut menu.
 

zeroaccess

Active member
Local time
Today, 07:44
Joined
Jan 30, 2020
Messages
671
I guess so, but I didn't presume that the user had the number at hand.

How is that choice made if the original problem hasn't been solved? So far, there's no textbox in a shortcut menu.
The text box would be on the form. I may be wrong to assume that a text box can't be put on a shortcut menu, but it doesn't seem likely.

You may offer both: cascading combo boxes for users who like to mouse, and a text box for those who prefer not to waste their time :p

Also, I would advise to design for what users are familiar with. A text box for entry within a menu is not something users would ever encounter within the Microsoft Windows environment, and probably not within the Apple world, either.
 
Last edited:

Phisaw

New member
Local time
Today, 07:44
Joined
Aug 11, 2010
Messages
12
Wow, thanks for the replies and suggestions. Please let me give a little background for the right-click shortcut menu I'm trying to create. I'm redesigning an old 2000 format database. The main form contains tracking info for job repairs. The navigation menu, on this job form, contains unassociated labels, in place of command buttons (couldn't format at the time), to requery said job form, open other forms, print docs, etc.

The user would click on the label, an input box would open asking for job number, and then if the job number was available, the form would open to the requested job, or if not available, a msgbox would open stating non-existing job - try again or new record.

On my newly designed database, I cannot format the input box and the color scheme looks odd against our company colors.
I tried creating a form as an input box/form, but if it opens acdialog (as it needs to), it still has the blue bar across the top.

My navigation menu is still located on this form with labels in place of command buttons. I want users to basically work from this one form. The list of labels was becoming cluttered, so I decided to group them with right-click menus for each group, example: Contact label - pop out menu to Edit Contact or Add New Contact. I plan on having a note at the top to right-click each label for more options.

Since I can't get past a popup form without the ugly blue bar across the top, I wanted the same for the Job Number label - pop out text box to search for job number or New Record.

I found this article with sample db here: Understanding Command Bars that contains a textbox, but I can't get it to work.

If anyone can help with either the shortcut textbox or an acdialog form without the blue bar, I would greatly appreciate it.
Thanks again for the replies.
Pam
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:44
Joined
May 21, 2018
Messages
8,525
Since I can't get past a popup form without the ugly blue bar across the top, I wanted the same for the Job Number label - pop out text box to search for job number or New Record
Can you show a screen shot? I do not understand what the blue bar is
 

Micron

AWF VIP
Local time
Today, 08:44
Joined
Oct 20, 2018
Messages
3,478
I suspect that would be the title bar. To remove it, set border to None.
EDIT - if that proves satisfactory you will likely need code on form open to position the input form somewhere and it won't be moveable.
 
Last edited:

Phisaw

New member
Local time
Today, 07:44
Joined
Aug 11, 2010
Messages
12
I suspect that would be the title bar. To remove it, set border to None.
EDIT - if that proves satisfactory you will likely need code on form open to position the input form somewhere and it won't be moveable.
I've set the border to None and every other option available and it will not change when the form is opened vba acdialog. The acdialog overrides the border option. Too me quite a while and a lot of internet searching to figure it out.
Thanks again,
Pam
 

zeroaccess

Active member
Local time
Today, 07:44
Joined
Jan 30, 2020
Messages
671
I've set the border to None and every other option available and it will not change when the form is opened vba acdialog. The acdialog overrides the border option. Too me quite a while and a lot of internet searching to figure it out.
Thanks again,
Pam
Different background colors for the form header and detail section?
 

Micron

AWF VIP
Local time
Today, 08:44
Joined
Oct 20, 2018
Messages
3,478
Don't use acDialog. Use popup and/or modal properties instead?
 

Phisaw

New member
Local time
Today, 07:44
Joined
Aug 11, 2010
Messages
12
All,
Thank you for your time and help. I've decided to discard the idea of the shortcut (right-click popout) menus for unassociated labels and include an unbound textbox to search for the job number. After multiple attempts with various ideas, I agree with zeroaccess, that it is faster and easier to use a textbox than multiple menu clicks, popup forms, and combo scrolling.
I appreciate your time and suggestions.
Thanks again for your help.
Pam
 

Users who are viewing this thread

Top Bottom