View Single Post
  #5  
Old February 6th, 2010, 12:18 PM posted to microsoft.public.access.gettingstarted
Jim Brooks
external usenet poster
 
Posts: 14
Default Button Caption help

Thanks to all for the advice I removed the buttons and replaced them with
list boxes and used the onclick event to load my reports and it works fine.
Still learning.
Thanks again
regards Jim Brooks

"John Spencer" wrote:

In the load event of the form you could set the caption on each button based
on looking up the relevant value.

If you have three employee records with these two fields you should be able to
do it.
Employee Table
EmployeeName
ButtonNumber (1,2,3) for the three buttons

In the Form's load event you would need three statements

Me.Cmd1.Caption= DLookup("EmployeeName","EmployeeTable","ButtonNumb er=1")
Me.Cmd2.Caption= DLookup("EmployeeName","EmployeeTable","ButtonNumb er=2")
Me.Cmd3.Caption= DLookup("EmployeeName","EmployeeTable","ButtonNumb er=3")

Although I think this would not be the best way to handle this situation, it
can be done. I would rather have a control (a combobox or a listbox) that
listed the employees and then have code in the after update event of the
control or the click event of a button that does whatever the buttons are
doing now based on a value in the combobox/listbox.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

KARL DEWEY wrote:
Why not use text box instead of label and use DLookup as source?

.