MS Access Form with Dynamically generated buttons

G

ghadley_00

Hi,

I have a database with a main table and a lookup table of customers,
and reports for each of the customers listing each transaction they
have listed.

I have a form that has buttons for each of the reports that is written
by hand.

At present the number of customers can be altered manually, but that
requires a button to be added or removed from the form.

Can anyone recommend a way to make a form that will dynamically add or
remove buttons (or make a drop down list) based on the entries
currently in my table of customers such that the appropriate report
gets accessed?

In other words, if there are 3 customers in the lookup table, the form
should have only 3 buttons, each of which is labeled using a Dlookup
command for the proper text label (I already have this working
statically), and pressing on each of these buttons will open a report
with the appropriate parameter passed to it. And if the number of
customers increases, then additional buttons appear on their own.

Best wishes,

George Hadley
(e-mail address removed)
 
D

Dirk Goldgar

George Hadley said:
Hi,

I have a database with a main table and a lookup table of customers,
and reports for each of the customers listing each transaction they
have listed.

I have a form that has buttons for each of the reports that is written
by hand.

At present the number of customers can be altered manually, but that
requires a button to be added or removed from the form.

Can anyone recommend a way to make a form that will dynamically add or
remove buttons (or make a drop down list) based on the entries
currently in my table of customers such that the appropriate report
gets accessed?

In other words, if there are 3 customers in the lookup table, the form
should have only 3 buttons, each of which is labeled using a Dlookup
command for the proper text label (I already have this working
statically), and pressing on each of these buttons will open a report
with the appropriate parameter passed to it. And if the number of
customers increases, then additional buttons appear on their own.

You could use a continuous subform based on your Customers table. You
can format each customer name to look like a command button, using
properties SpecialEffect=Raised, BackStyle=Transparent,
TextAlign=Center, Locked=Yes, and Enabled=No. You'd need to put a
command button on top of the customer name text box, with its property
Transparent=Yes, and use the Click event of that command button to open
the report for the customer whose record is now current (having been
clicked on). The form as a whole would want to have all of its Allow...
properties set to No.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top