Solved Colour code data entry row (1 Viewer)

access2010

Registered User.
Local time
Today, 09:18
Joined
Dec 26, 2009
Messages
1,019
Could I please receive a suggestion on how to colour code the ROW into which the user is entering data into?

We are using MsAcess 2003

Thank you,
Nicole
 

Attachments

  • Data_Entry_Position_2020_Oct02.pdf
    96.4 KB · Views: 134

Ranman256

Well-known member
Local time
Today, 12:18
Joined
Apr 9, 2015
Messages
4,339
in continuous form, all rows must be the same color OR alternating colors (altcolor) a,b,a,b
NOT all rows 1 color, except entry row.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:18
Joined
Oct 29, 2018
Messages
21,358
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
Using old technique.
selected.png
 

Attachments

  • paint.accdb
    556 KB · Views: 109

access2010

Registered User.
Local time
Today, 09:18
Joined
Dec 26, 2009
Messages
1,019
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,
Nicole
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
2003 format
 

Attachments

  • paint.mdb
    352 KB · Views: 121

access2010

Registered User.
Local time
Today, 09:18
Joined
Dec 26, 2009
Messages
1,019
2003 format
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
 

Attachments

  • Expression.mdb
    600 KB · Views: 116

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
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.
 

Attachments

  • Expression2.mdb
    312 KB · Views: 112

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
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
 

access2010

Registered User.
Local time
Today, 09:18
Joined
Dec 26, 2009
Messages
1,019
Your suggestion works, MajP, but.

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.

Thank you
Nicole
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
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.
 

access2010

Registered User.
Local time
Today, 09:18
Joined
Dec 26, 2009
Messages
1,019
May I refer to you as professor, MajP.
Your instructions work and we do appreciate your assistance.

Nicole
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
Thanks, but I am just demonstrating a common approach. So no original thought on my part was needed.
 

access2010

Registered User.
Local time
Today, 09:18
Joined
Dec 26, 2009
Messages
1,019
Thank you for your assistance and the background colouring has worked for ALL the forms we worked on but this one.

Would you please let me know what I have done wrong with this form (Investments_StockBrowse_F_BuySell)?

Thank you,
Crystal
 

Attachments

  • Portfolio=294.mdb
    796 KB · Views: 112

MajP

You've got your good things, and you've got mine.
Local time
Today, 12:18
Joined
May 21, 2018
Messages
8,463
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.
 

Users who are viewing this thread

Top Bottom