• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 522
  • Last Modified:

Field to show which record is current

I've got a continuous form with no record selectors.  The current record is set in VBA by a "find and bookmark" routine, with input from another form

I'm trying to think of a way to highlight that the record is current, without using record selectors.  I'm willing to add a bound field to the source table.  The recordset would be small, so I suppose I could update the value of that field in every member of the recordset, and then use conditional formatting...

Any better ideas would be appreciated.

Thanks!
0
codequest
Asked:
codequest
  • 4
  • 4
  • 2
  • +2
4 Solutions
 
hnasrCommented:
Try this assuming a form field: Fld

Private Sub Form_Current()
    Fld.SetFocus
End Sub
Conditional format of Fld, When has focus, select background color
0
 
codequestAuthor Commented:
Tried this

Screen.ActiveControl.Name="CurrentRow"

where "CurrentRow" is the name of the target "current status display" field, but conditional formatting is then true for all rows, any time the field is made focus.
0
 
hnasrCommented:
Do the table has a numeric primary key?

Upload a database with the form and table.
I managed to do it. No need for a new table field, but an unbound text box.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<I'm trying to think of a way to highlight that the record is current, without using record selectors.  I'm willing to add a bound field to the source table.  The recordset would be small, so I suppose I could update the value of that field in every member of the recordset, and then use conditional formatting...>>

  Use confitional formatting on the controls to high light it, or use the old technique of a bound OLE field behind the other controls to color the row.

  Example is attached.

Jim.
ContinuousFormColors.zip
0
 
hnasrCommented:
Try:
Table a(aID, f1,f2 ) aID is a Unique field

Add unbound field name: txtCurrentRecord
   Border Style: transparent
   Fore Color: White, or a form matching color
   Conditional Formatting: Expression is: txtCurrentrecord-CInt(aid)=CurrentRecord
   Fill Color: Red
   text Color: Red

Private Sub Form_Current()
   txtCurrentRecord = CurrentRecord + aID
End Sub

Open in new window


Check this sample database.
show-current.accdb
0
 
Helen FeddemaCommented:
One of my Access Archon sample databases uses a method to highlight the currently selected row in a continuous subform:

Highlighted CF subform row
It uses code run from a combo box record selector in the form header; you might be able to modify it to run from wherever you are selecting the record.  Here is a link for downloading the database:

http://www.helenfeddema.com/Files/accarch173.zip
0
 
Jeffrey CoachmanMIS LiasonCommented:
Also Stephen Lebans has some great techniques for doing things like this as well:
http://www.lebans.com/conditionalformatting.htm
0
 
hnasrCommented:
Improved version:
show-current-2.accdb
0
 
codequestAuthor Commented:
Thanks for the inputs.  I implemented it using a DAO.Recordset update on a bound field.  

However, I will review these ideas and reward points.  It may take a few days.
0
 
codequestAuthor Commented:
Sorry this is taking me so long. I want to review the responses, need more time, so I'm adding this comment so the question doesn't go dead.
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
OK.  Thanks for posting back.  Let us know if you need anything.

Jim.
0
 
codequestAuthor Commented:
Unfortunately I have not had time to evaluate all of these solutions.  I effectively used JDettman's answer, though before I saw his post (it was an idea in my original question); I accept his solution as confirmation that it was a reasonable idea.  I appreciate everyone's efforts, and I have awarded points with the intention of letting other people see these potential solutions in the future.

Thanks!
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 4
  • 4
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now