Row selection

KabirPatel

Registered User.
Local time
Today, 13:07
Joined
Nov 16, 2006
Messages
38
Hi,

I have a continuous form that is bound to a table. Each record in this form consists of text boxes.

I have added a button named "Select Me!" to the end of each row. When the user presses the button I would like the selected row to be highlighted.

I added the following code in the click event of the button:

Me.Detail.BackColor = 255 'red

However, upon pressing the button all of the rows turn red. Is there any way around this?

Cheers,
Kabir
 
Hi,

I have a continuous form that is bound to a table. Each record in this form consists of text boxes.

I have added a button named "Select Me!" to the end of each row. When the user presses the button I would like the selected row to be highlighted.

I added the following code in the click event of the button:

Me.Detail.BackColor = 255 'red

However, upon pressing the button all of the rows turn red. Is there any way around this?

Cheers,
Kabir

You should use the Conditional Formatting to change the background of the controls in the Detail section (but command button).
In the table, you add a Yes/No field (named selected or else), default value: 0
In form, add a checkbox (name: selected, control source: selected), select all textboxes, choose menu Format --> Conditional Formatting. In Condition1, choose Expression Is, and the next textbox type selected (or selected <> 0).
Then you set the background to the desired color.
When press the Select Me!, you set selected = True
 
Many thanks for that.

I have got it working, however I would like only one record to be highlighted at a time.

At the moment when I press the "Select Me" button it highlights the text boxes for the currently selected row and the previously selected rows.

Is there a way around this?

Cheers,
Kabir
 

Users who are viewing this thread

Back
Top Bottom