Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pass data from current open button

Status
Not open for further replies.

lewie

Technical User
Jan 17, 2003
94
US
When I click on a button I want to run a query which will use the current buttons name or caption in it's criteria section. I can do it for a button. How do i do it for the currently selected button.
Thanks
Lewie
 
I'm not sure I understand your question correctly but I think you want a separate sub or function which accepts the button name as criteria.

private sub Button1_Click()
RunMyQuery "button1"
end sub

private sub Button2_Click()
RunMyQuery "button2"
end sub

private sub RunMyQuery(byVal ButtonName as String)
Code:
end function
 
Thanks for the quick answer.
what i want is to extract the caption of the currently selected button and pass it to a query.
forms!myform!currentbutton.caption
is there any such syntax to extract the caption from the currently selected button.

forms!myform!btn_1.caption will give me the caption to btn_1 but then i need a query for every button.

I know i can get at a current record with a recordset I was just wondering if it was possible to get the caption(or properties) off the currently selected button(or object)
Thanks again
Lewie
 
Have you tried something like this ?
Forms!myform.ActiveControl.Name

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanks again.
you know what works screen.activecontrol.caption
i stumbled across something close in my cookbook.
Thanks again for the help
lewie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top