Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make dynamic vs static labels next to options check boxes 2

Status
Not open for further replies.

DanLo

Technical User
Sep 20, 2001
11
US
I recently developed an invoicing program using MS Access. In several of the forms (not the main form), the options box contains 20 check boxes with a label for each checkbox. When you click on one of the checkboxes, a single text box (not a list box) on the main form shows the text of the corresponding choice. The table linked to the options box has 20 records with two columns: OptionNo (numbering 1 - 20) and OptionText (the text to be displayed on the main form).

Everything works as it should. However is there any way to make the label text on the options box dynamic (i.e., changeable by the enduser) instead of having to go into the Design Mode and changing the labels of the checkboxes and then going into the linked table and making the changes in the appropriate row of column 2 (OptionText)?

I was hoping that there is a way to link the OptionText column records in the table to the corresponding text in the options box.

I hope I stated the problem clearly and correctly.

Thanks
DanLo
 
I would think you should be able to set the .Caption property at run time?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
DanLo
Rather than using a label, you could use an unbound text box. Then, use code on the AfterUpdate event for your Option Group which will dynamically change the content of the text box.

e.g.
Code for the AfterUpdate event might look like...
Me.YourTextBoxName = Me.OptionText

Naturally, you will have to twiddle with the names, and maybe use the column #, depending on how your form is set up.

Tom
 
I wasn't very specific, but the .Caption property of the Checkboxes corresponding Label.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
THWatson
I think the way to go would be as you suggested. However, where I'm having the difficulty is specifying the Row. For example LblOptTxt01 will be from Column 2, Row 1 of the TechOption table; LblOptTxt02 will be from Column2, Row1; etc. Although I have an idea as to how to specify a column, how can I get the text box to look at a specific row?

DanLo
 
DanLo
You should be able to reference the column and row you wish to select by adding .Column(column #, row # ) to your expression.

In other words...
Me.YourTextBoxName = Me.YourComboBoxName.Column(2, 1)

However, remember that Access columns and rows start numbering at 0. So the above expression will yield the 3rd column, the 2nd row. Therefore, you will have to play with the columns and rows to get it right.

Hope that helps.

Tom
 
Hay Cajun . . . .

I think you were more than specific enough. Obviously they never bothered to check . . . . . .

Calvin.gif
See Ya! . . . . . .
 
DanLo
There is no question that CajunCenturion and TheAceMan1 are right. If you want to use labels rather than text boxes, you can change the label dynamically by setting its Caption property at run time...

Something like...
Code:
Me.YourLabelName.Caption = Me.YourComboBoxName.Column(colum #, row #)

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top