Solved

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

Posted on 2013-01-13
5
1,289 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

808 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