Microsoft
Software
Hardware
Network
Question : Using msoControlEdit to enter search parameter?
Hi,
I am using CommandBar coding to create shortcut menus for my forms. I'm no expert but I've done pretty well so far.
I would like to be able to add a Text Control (msoControlEdit) to my Shortcut Menu where I can enter a name (e.g., "Michael") that i want to search for; after I enter the text and click the enter key, I want Access to go to a field on my form and look for the text "Michael" using docmd.findrecord and referencing the text I've entered in my shortcut text box.
I guess all I need to know is how do I reference the input text in my function I'll use to find the text? I will then use that function as my .OnAction.
I hope that makes sense. Easy question, just don't know how to reference the parameter I've entered on the menu.
Bill
Answer : Using msoControlEdit to enter search parameter?
You can set the OnAction of your commadbar control to be a custom Function you've defined in a Standard Module, and use that function to refer back to the edit box. For example, in my db I've created a MenuBar named "ScottsBar", and on that is a Combo (aka a "CommandBarPopup") named "MyMenu". MyMenu has an Edit control named "Textbox1". I've set the OnAction property of Textbox1 to this:
=fncSearch()
Note that you MUST use this syntax, including the equals sign and parentheses. You could, of course, alter the code below to do something more than popup a messagebox; in your case, I'm assuming you know how to initaiate your search features and such.
'/ Add this code to a Standard Module; you'll of course need to change the names of the MenuBar and controls to match your own
Public Function fncSearch()
Dim pop As Office.CommandBarPopup
Dim ctlEdit As Office.CommandBarControl
Set pop = Application.CommandBars("S
cottsBar")
.Controls(
"MyMenu")
Set ctlEdit = pop.Controls("Textbox1")
MsgBox pop.Controls("Textbox1").T
ext
Set cltedit = Nothing
Set pop = Nothing
End Function
Random Solutions
There is insufficient system memory in resource pool 'internal' to run this query. WE upgraded from a 32 bit, 4 GB, Windows 2003 server, SQL server 2005 machine to a 64 bit, 2 processor quad core, 8
Excel Macro to Compare Cells and Edit the Workbook
DevExpress XtraTreeList - tree structure
I am trying to get the "Currently" selected item in a multiple selection listbox - how can this be done?
How to Change Database Collation
SQL data sorting
Need SQL Syntax help to make my qry more efficient.
Can it hurt to run repadmin/removelingeringob<wbr />jects
Re-Formula =SUMPRODUCT for report creation
HELP, I fallen on a 'Runtime Error 3134 Syntax error in INSERT INTO statement' and i can't get up!