Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-01-13
5
Medium Priority
?
1,337 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 1000 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 31

Assisted Solution

by:hnasr
hnasr earned 1000 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 Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

688 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