Modules & VBA :: How To Have A Shortcut Option When Right Click On Each Item On List Box
Aug 1, 2013
how I can have a shortcut option when right click on each item on the list box. So I got my answer with below code that opens another form "frmshortcut" with a listbox inside that shows list of options like "new task" , "edit item" . Now my problem is (like attached picture) the shortcut list (frmshortcut) will be open in another place when I right click the mouse, it is far from location of click. Also it shows some default in access when I right click in the listbox ("subform", "cut", "copy"), actually I do not like it shows these, just I like it shows shortcut list I have defined by the list box.
Private Sub ItemList_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Const RIGHTBUTTON = 2 If Button = RIGHTBUTTON Then DoCmd.OpenForm "frmshortcut"
' DoCmd.OpenForm "frmshortcut", acNormal, , , , acDialog
Forms!frmshortcut!txtparameter = Me.ItemList.Value
End If
End Sub
Show me the selected item in a Listbox without looping in the whole list, because my Listbox is multiselect and I want only the item that selected recently.
I have a simple listbox (single column, no multi-selection).I want to enable a command button when the user selects an item in the listbox / disable it if no items are selected.I'm using the AfterUpdate event of the listbox, as follows :
Code:
Private Sub lstOptions_AfterUpdate() Select Case Me.lstOptions.ItemsSelected.Count Case 0 Me.comConfirm.Enabled = False Case Else Me.comConfirm.Enabled = True End Select End Sub
But when I select an item from the listbox, and debug the code, the Count is always zero? Even though I can see the item selected??
I am running Access 2010. I have added the following to the "On Open" event on my main form:
Code:
Private Sub Form_Open(Cancel As Integer) DoCmd.ShowToolbar "Ribbon", acToolbarNo DoCmd.NavigateTo "acNavigationCategoryObjectType" DoCmd.RunCommand acCmdWindowHide Me.ShortcutMenu = False End Sub
My main form (frmMain) is displayed when the database opens. As you can see, I am hiding the ribbon and the navigation pane from users. I also want to prevent users from right clicking on the form and opening it in Design view - trying to prevent any monkey business. However, the line:Me. ShortcutMenu = False
is not preventing users from right clicking on the form and getting the shortcut menu and going into Design view.If I go to Options and uncheck: "Allow Default Shortcut Menus" then I lose the ability to print reports because I have the ribbon hidden and this will not allow right click on reports.Converting to .accde is not an option at this time.
Is there a keyboard shortcut that simulates the double click.
In my Sectionfrm I have a command button that opens my Ordersfrm. Because I use the Ordersfrm for reasons not always associated with the Sectionfrm I do not automatically populate the SectionID (textbox) in the Ordersfrm with the SectionID from the Sectionfrm.
When I want to link an order to a (building) section I double click the SectionID field in the Ordersfrm which in turn runs VBA code that copies the SectionID from the Sectionfrm to the Ordersfrm.
As I tab through my form I find it annoying to move away from my keyboard to the mouse to double click the SectionID, so the question is:
Is there a keyboard shortcut that simulates the double click to run the VBA code?
how to customize my right click "Short-cut" menu in Access 2010. I need a right click menu with ONLY the "Print" and "Print Preview" options for my reports and I would like to disable right click in all other objects.
I have a form (about patients) containing a listbox (list of visit dates) and a subform (showing medications at that date). When you click on the listbox, the subform is re-queried with the selected date as a parameter to show the medications that were in use on that date. This is working fine.
However, when you move to a new record (patient), the subform is initially blank because the listbox hasn't been clicked on yet. This means that it looks like the person isn't on any medications, which is causing some confusion.
I need a way to have the subform show the "top" (most recent) date because that is the current medication list, and the thing most people want to see first. It is always the top of the list, so I would like to do something like this (pseudocode)
Code: Private Sub Form_Current() Forms![MedSearch].SelectDateBox.Requery Send MouseClick Event to line 0 of SelectDateBox End Sub
I'm building a database that will allow me to enter medical information about patients. On the present form (paper) one of the question asks about the medical history of the patient with 7 available options( Diabetes, Cardiac, HIV etc). The 7th option is 'OTHER' and the patient is supposed to specify what Other refers to.
How can I translate this to an Access form?
I am thinking of a list of the 7 options, but when option 7 is selected; the user should be prompted to enter a specific disease.
QUESTION? How can this be achieved, and how should the table be designed to accept this entry?
I have a multi slect list box (simple) and I need to find and select an item using vba - e.g., the bound column is the ID field and I need to select a specific ID (which will be different each time) as opposed to selecting the 100th record for example. How do I do this?
I have created listbox with one column (contains one column only), now i would like to display all the characters of list item (want scroll bar to listbox).
How do i display all text of list item, I have already fixed Column Widths to max length (22";0.1"). However when scrolling to right, it is going to next blank column of list box, which is created only to change Column Widths property.
I have a form with a combobox whose list items are taken from a table of currencies (called tblCurrencies)
Row Source = SELECT [tblCurrencies].[Ccy] FROM tblCurrencies ORDER BY [Ccy];
Problem is, there may come a time when the currency they want to select is not yet part of the tblCurrencies table, and needs to be added. For simplicity, I'd like to have an additional option in the dropdown (perhaps at the bottom) to specify a new currency.So an additional list item (e.g. 'Add New...') which when selected could prompt a subform where the user could specify the new currency (and any other relevant details specific to that currency) which can be programmatically added to tblCurrencies.how do I get that extra option into the list items for the combobox?...
I currently have a listbox. (list32) that is populated with results of a query. I would like to doubleclick on an item and have it open a form that displays the listbox record i clicked on and a "notes" field. Its my understanding that the table fields are limited to 255 chars so i was curious if I could make the notes field reside somewhere else. I will need the notes able to be edited, specific to record entry, and then saved on exit. Is this doable?
If the 5th option (Other) is selected, the user is required to specify what 'Other' represents.
I have created a combo box with the first 4 options and in instances of 'Other' the user can enter specific treatment that is not in the list (1 to 4).
What I would like to do is whenever the user enters a value that is not on the list (1 to 4), I would like to insert the word OTHER in front of the value entered. In other words all values not on the list will be prefixed by 'OTHER'. E.G. if 'Surgery' is entered, I would like the value 'OTHER : Surgery' to be stored in the Treatment field of the table.
This will help in the generation of statistics from the table.
Hi I have placed a Listbox in MS Access form. I use VBA. I have saved the item selected in the List box in a database. While retrieving the item from database, I want the listbox selected i.e the item should show as highlighted in the list box. Is this possible ?
HI all, the objective is to grey out an item within a listbox, where the id number is the same in another sub form. The sub form is called contacts and the list is called list15. the unique id that is linking the two is SWD.
I would like to be able to create a recipe (saved in its own table) by pulling items from a multiselect list box (from the raw materials table) but which allows me to add the same ingredient more than once.
I work for a chemical manufacturing company and we need to track the cost of goods by recipe (final product), by linking the ingredients (where the cost of the raws are associated) to the final prodcut. Several of our products need to have chemicals added in the beginning, but then again at the end of the procedure unlike normal kitchen recipes.
(I sure hope I don't have to learn VBA . . . I'm totally new at Access!)
I am using a combo box in my form. It is a growing combo box allowing new entries to be entered to create a growing list.
When new entries are made to the combo box list they are only displayed when I quit the form and then return to it. Is there any way I could allow the combo box list to grow dynamically rather than having to get the user to quit the form and then return to it?
Didnt know where to start or what direction to head in. I have a combo box on one of my forms. It works fine, but would am looking for an added feature.
I am looking to get the following started:
There are 5 items in the list of my combo box. If the user selects the item called "Lost Opportunity", then how do I get an additional combo box to show up underneath it with reasons the sales opportunity was lost.
Then the reasons why would be in the additional box and they would have to select one...my work wants it so that if they lose the sale, they must provide a reason for that loss of business.
I have made a few cascading combo-boxes that dynamically change based on the data entered into the field above them.. Example:
A SKU is entered, the combo-boxes pull the information for that sku from one or more tables (using SQL Query).
Now... I am having trouble getting these fields to show the first item in the list of possible item specifics. Everything comes in fine, however, I need to form to refresh and repopulate the fields one the SKU loses focus.
I want to select an item in a listbox that has a specified value when I open the form that contains this listbox. Most I've found describes selecting records based on their index value but I want to select an item according to the actual value that's displayed in the listbox. For example, the first number below is the index value, the 2nd is the number I'm interested in and the 3rd is another column in the listbox:
0 1 12345 1 2 33256 2 4 36280
I'm using the OpenArgs property to pass the value (a long integer primary key) to the opening form but I don't know the syntax or correct terminology for ensuring the specified row is selected in the listbox. At present, using the above example, if I want to select the row with the value 2, it's selecting the 3rd row rather than the 2nd.