Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS Access 2003 build buttons from table with VBA?

Posted on 2013-01-18
3
255 Views
Last Modified: 2013-01-18
I have a table that has 5 or 6 items in it

On a form I want to dynamically create buttons (vertically)

Assign vba events (save text to SQL table) actions to the dynamicallly created buttons.
0
Comment
Question by:lrbrister
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38793498
0
 

Author Closing Comment

by:lrbrister
ID: 38793521
That'll do it!
Thanks...as always
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38793576
Rather than building buttons dynamically (bad idea), I would suggest you create a continuous subform that contains a textbox associate with each record.

1.  Format this textbox by setting its SpecialEffect to raised, and BackColor to System Button Face.
2.  Use the GotFocus event of the button to move the focus to another control on the form (use a dummy textbox with zero width, and backstyle = transparent if you need to).  Also in the GotFocus event, execute whatever it is you want to do by using the Eval() function.

In my example, I display the action that I want to take in the textbox to the right of the "button".  As you can see, you can even pass the name of a function using this technique.
BuildButtons.mdb
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

837 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