Solved

MS Access 2003 build buttons from table with VBA?

Posted on 2013-01-18
3
252 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 119

Accepted Solution

by:
Rey Obrero 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

758 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

21 Experts available now in Live!

Get 1:1 Help Now