Solved

Access:  Catch the cmd buton that was pushed

Posted on 2011-02-24
5
345 Views
Last Modified: 2012-06-27
I have a alpha-numeric keyboard built in Access on a from.  Has letters and #'s and accounts for what language is selected so the caption changes.

I want to run the same SUB for each button and passing the value of the button.  I don't want to code each buttun with ....call perform_Search(xxx).

Is there a way to catch what button was pressed at a higher level...similar to in excel.
application.Caller

I have thought about an option group as a solution.

I want something like this:

: when form buttons are clicked
: check if the tag or something is that button
: get the value of the button
: pass to the search function.

tnx for the help
0
Comment
Question by:skillilea
  • 3
  • 2
5 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 34972605
i would use an option group for this purpose, so you can easily pass the info to the function using the value of the option group in the afterupdate event of the option group

private sub optionGrp_afterupdate()

call perform_Search(me.optioGrp)

end sub

0
 

Author Comment

by:skillilea
ID: 34974266
Looks like I can only have 20 options in the group so would need two groups for sure.  

Access 2010.

hmmm...

0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34974911
i can place more than 30 options in an option frame without problem
i used toggle button instead of command button
0
 

Author Comment

by:skillilea
ID: 34975010
nice...I used the wrong type..

is there an easy way to add more buttons to the frame?  Can I just copy and paste in?

tnx
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34975293
<is there an easy way to add more buttons to the frame?  Can I just copy and paste in?>

yes, then just change the option values.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now