Hi Nicole. One old technique was to add an unbound Textbox in the background of all your controls and make it as tall and as wide as the Details section. You would then apply Conditional Formatting to that Textbox to highlight the current row.
Hi Nicole. One old technique was to add an unbound Textbox in the background of all your controls and make it as tall and as wide as the Details section. You would then apply Conditional Formatting to that Textbox to highlight the current row.
Thank you for your suggestion, which I have tried, Using Conditional Formatting;
Field Value is = Equal to = -1 = colour Orange.
But the background colour does not change from White.
Could you please let me know what I have done wrong, or could you send us a file with your suggested criteria?
Thank you, MajP, for your 2003 Database and for your code.
I think that I have done what you have suggested, but my results are not as your database.
Could you please let me know what I have done wrong.
Thank you.
Nicole
You need to add an unbound text box called txtLink. You can make it invisible. I left it visible in the header for now. Then in the current event you need
Private Sub Form_Current()
Me.txtLink = Me.Investmentl_ID
End Sub
Then in the conditional format you need
[txtlink]=[Investmentl_id]
Also make your unbound textbox disabled. If the formatting box is enabled when you click on it, it will bring the focus forward and you will not be able to see the other textboxes.
Even with the formatting text box disabled I saw it can still cause the controls to be hidden depending where you click. Instead leave it enabled but on the controls got focus event, send the focus to one of your controls like stock_Name
Private Sub Text358_GotFocus()
Me.Investmentl_ID.SetFocus
End Sub
We can not figure out how to get your controls to work.
What one of the volunteers did was to import your form into our database and then copy and past our form's fields into your colour background form and it WORKS.
What do you thank that I am missing?
We can live with this backhand approach, but if you have an opportunity, I would still like to know what I doing wrong.
I mentioned in the previous thread, the things that you forgot to do.
1. Although there are several ways to do this the way I do it is to have the hidden unbound textbox. I usually put it in the header. In my example I called it "txtLink". I did not see this on your form
2. In the forms OnCurrent event you set the value of "txtLink" to the current primary key. You did not have this
Code:
Private Sub Form_Current()
Me.txtLink = Me.Investmentl_ID
End Sub
So if the current record has an Investmentl_ID of 6, so does the txtLink
3. Now in in conditional formatting you would need an expression
[Investmentl_ID] = [txtlink]
You did not have the correct name of Investmentl_ID
So the way it works is you click on the current record. It sets the value of the current records ID into txtLink. Conditional formatting looks to see if each records Investmentl_ID is equal to txtLink and only the current one is.
Not sure why this does not give an error earlier. Your form is unbound (no recordsource), but you have a control Investment1_ID and it is "bound" to Investment1_ID. I would think this would fail on open. However if you are changing the recordsource and that recordsource returns no records then you may need to error check that condition.