Solved

MS Access 2003 build buttons from table with VBA?

Posted on 2013-01-18
3
257 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
[X]
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
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 48

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

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!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 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