Solved

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

Posted on 2013-01-13
5
1,322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

635 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