[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

Access: Catch the cmd buton that was pushed

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
skillilea
Asked:
skillilea
  • 3
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
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
 
skillileaAuthor Commented:
Looks like I can only have 20 options in the group so would need two groups for sure.  

Access 2010.

hmmm...

0
 
Rey Obrero (Capricorn1)Commented:
i can place more than 30 options in an option frame without problem
i used toggle button instead of command button
0
 
skillileaAuthor Commented:
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
 
Rey Obrero (Capricorn1)Commented:
<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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now