473,778 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Access Form with Dynamically generated buttons

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
gh********@yaho o.com

Apr 8 '06 #1
2 4907
Your method will quickly become unusable. What happens when there are 200
customers? Why not have ONE button (labeled "Selected Customer" or whatever
you like) and use the linkcriteria property to run the appropriate report?
-Ed

<gh********@yah oo.com> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. .
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
gh********@yaho o.com

Apr 8 '06 #2
gh********@yaho o.com wrote:
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.


The only way I can think of doing this is using a continuous form or
subform that is bound to your customer table. You'd have to use form
view (not datasheet view) and on each detail you'd have a button. You
would *not* be able to have the proper label text on the button. This
is because buttons cannot be bound to data. Rather, what you'd do is
have a text box and then your button with a cutesy image or just plain.
Perhaps with controltip text like "click me for a report on this
customer".

Assuming you customer table has a structure with fields like like
Cust_Pk, Cust_Name, the Cust_Name being the full customer name would be
the controlsource for the text box. The button would have code
something like the following air code:

Sub btnCustReport()

'Opens a customer details report with the report
'based on the current Cust_Pk

on error goto err_Proc

docmd.openrepor t "rptWhateve r"

Exit_Proc:

Exit sub

Err_Proc:

select case err.number

case 2501 'report is cancelled

resume exit_Proc

case else

msgbox "Error " & err.number & " " & err.description , _
vbcritical,"Err or on Opening Report", err.helpfile, err.helpcontext

resume exit_Proc

end select

end sub

Your report, instead of perhaps being "hand written" should have a
recordsource SQL statement or saved query such as:

Select <blah, blah>
From <whatever>
Where Cust_Id = forms!frmMainfo rm.CustId
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Apr 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3236
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically generated, though. I'd like to capture the NAME of every HTML form field element on the server, even if that element is submitted blank. The trouble is, with, say, radio buttons or checkboxes for example, a *blank* element does not get submitted at all.
7
3562
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET) template. Briefly -------------------------------------------------------------------------------------------- I need to create dynamically some controls on the forms, and display these
6
4753
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
49
14358
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
1
1161
by: PeteBr | last post by:
I am dynamically generating a number of button controls based on the results returned from a search carried out on another machine. When one of these buttons is selected I want to be able to go through the same event handler for each button but I can't seem to get to happen unless I regenerate all my previously dynamically generated buttons every time the page is submitted. Is this the only way to do this as the original search can take quite a...
0
2531
by: Boris | last post by:
When I dynamically create CheckButtonList, I add ListItem(s) to my CheckButtonList object chkList chkList.Items.Add(new ListItem("My Text", "My Value")); The resulting HTML doesn't contain value="My Value". Therefore, I can't access "My Value" with Request.Form on post back. I do get the desired outcome with my RadioButtonList object radioList when I do
2
11982
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put them each in a GroupBox. All the examples I saw from the books or from the web show me how to add static radio buttons at design, or dynamically at run time but with fixed radio buttons (like from an array). I need to create radio buttons based...
1
1714
by: Paddy | last post by:
The problem I am facing is as follows: I am populating an HTML table on my webpage with rows of data from a database. The rows may be sometimes 10 and sometimes say,3. I have two buttons on that page "Next" and "Previous" which I want displayed just a couple of lines below the table dynamically. Thus the positions of these buttons would vary depending on how many rows are rendered. I was wondering whether there is a programmatic way of...
7
1388
by: Malakie | last post by:
Hi all, I am trying to self teach VB .net to myself. Not sure what is worse, trying to accomplish this or thinking I can actually do it! ;-) Anyhow, Would someone be able to give me some example VB net code that would create buttons on a form dynamically for each drive (cd or HD or virtual etc) found on a system; labeling each created button with one of the found drive letters. It would also need to remove said button if the drive...
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2865
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.