Solved

Access Continious Form  : Highlight Current record / Highlight row while creating new record

Posted on 2013-01-13
5
1,264 Views
Last Modified: 2013-01-14
I am using a Microsoft Access 2010 continuous form.

 When a user decides to create a new record in a continuous form, I would like to highlight the row that he is entering data into.  Remember,  the record does not yet exist in the underlying table.

This ties into a question about highlighting the current record.  It is relevant and ended prematurely.

On part 1,  the experts here were able to help me with highlighting the current row.   The solution is elegant.   Please see Access Highlight Current Record -- Nice and easy for a simple and effective way of highlighting the current record.

The solution was almost perfect,  except that when the user enters data in a new record,  the behaviour of the highlighting changed.  I would prefer consistency

The perfect solution would be to only highlight the row that is being edited for a new record.  The actual result differed.  Please see part 1.

The main contributers to my first question Hnasr and IrogSinta have offered more insights.  

Take it from here....  Experts
0
Comment
Question by:peispud
  • 2
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 250 total points
ID: 38772837
Okay, here's my solution which has 2 forms.  One highlights just the new record and the other highlights the new record as well as any record being edited.  

Please be sure to wait for the other experts to chime in especially since hnasr mentioned that he figured this out as well.
HighlightRecord.accdb
0
 
LVL 30

Assisted Solution

by:hnasr
hnasr earned 250 total points
ID: 38773200
Try this:
Form20_2
Record source: Table a(aID, f1, f2, cr_flag)
Controls: Bound: aID, f1, f2, cr_flag, Unbound: txtCurrentKey
cr_flag is used to store the currentRecord value when moving to a new record. It sets the value back to 0 before updating.
txtCurrentKey stores the current key of processed record

Private Sub Form_BeforeUpdate(Cancel As Integer)
    cr_flag = 0
End Sub
Private Sub Form_Current()
    txtCurrentKey = CInt(Nz(aID, 0))
    If NewRecord Then
        cr_flag = CurrentRecord
    End If
End Sub

Conditional formatting:
Expression Is ([txtCurrentKey]=Nz([aID],0)) And ([txtCurrentKey]<>[cr_flag])
Q-27993988-Highlight-current.accdb
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 38773292
@hnsar
Nice going!
0
 

Author Comment

by:peispud
ID: 38774000
This is PERFECT.!!!

Those few lines of code make all the difference.  The user experience is clear and consistant.

Thank you both.!
0
 

Author Closing Comment

by:peispud
ID: 38774004
This is PERFECT.!!!

Those few lines of code make all the difference.  The user experience is clear and consistant.

Thank you both.!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now